bug #I8AR0L 组件定义了重试和回滚,回滚也会被重试

This commit is contained in:
everywhere.z 2023-10-31 12:45:35 +08:00
parent 95cdb9ca68
commit d30020d4ff
2 changed files with 45 additions and 0 deletions

View File

@ -0,0 +1,25 @@
package com.yomahub.liteflow.test.rollback.cmp;
import com.yomahub.liteflow.annotation.LiteflowRetry;
import com.yomahub.liteflow.core.NodeComponent;
import org.noear.solon.annotation.Component;
@Component("m")
@LiteflowRetry(5)
public class MCmp extends NodeComponent {
private int flag = 0;
@Override
public void process() {
if(flag < 2) {
flag ++;
throw new RuntimeException();
}
System.out.println("MCmp executed!");
}
@Override
public void rollback() throws Exception {
System.out.println("MCmp rollback!");
}
}

View File

@ -0,0 +1,20 @@
package com.yomahub.liteflow.test.rollback.cmp;
import com.yomahub.liteflow.annotation.LiteflowRetry;
import com.yomahub.liteflow.core.NodeComponent;
import org.noear.solon.annotation.Component;
@Component("n")
@LiteflowRetry(3)
public class NCmp extends NodeComponent {
@Override
public void process() {
System.out.println("NCmp executed!");
throw new RuntimeException();
}
@Override
public void rollback() throws Exception {
System.out.println("NCmp rollback!");
}
}