1
0

优化监听器

This commit is contained in:
2025-01-07 09:56:56 +08:00
parent 465cc8cd3f
commit dddc9d7171
7 changed files with 135 additions and 10 deletions

View File

@@ -0,0 +1,46 @@
package com.lanyuanxiaoyao.flowable.jpa;
import com.lanyuanxiaoyao.flowable.core.manager.FlowableManager;
import com.lanyuanxiaoyao.flowable.core.model.FlowableAction;
import com.lanyuanxiaoyao.flowable.core.model.FlowableInstance;
import com.lanyuanxiaoyao.flowable.core.model.FlowableListener;
import com.lanyuanxiaoyao.flowable.core.model.FlowableNode;
import javax.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
/**
* @author lanyuanxiaoyao
* @version 20250106
*/
@Slf4j
@Service
public class SimpleListener implements FlowableListener {
@Resource
private FlowableManager flowableManager;
@Override
public void onFlowStart(FlowableInstance instance, FlowableNode node) {
log.info("onFlowStart with spring: {}", flowableManager.listNodes());
}
@Override
public void onFlowEnd(FlowableInstance instance, FlowableNode node) {
log.info("onFlowEnd with spring: {}", flowableManager.listNodes());
}
@Override
public void onActionStart(FlowableInstance instance, FlowableNode node) {
log.info("onActionStart with spring: {}", flowableManager.listNodes());
}
@Override
public void onAction(FlowableInstance instance, FlowableAction action) {
log.info("onAction with spring: {}", flowableManager.listNodes());
}
@Override
public void onActionComplete(FlowableInstance instance, FlowableNode node) {
log.info("onActionComplete with spring: {}", flowableManager.listNodes());
}
}

View File

@@ -2,6 +2,7 @@ package com.lanyuanxiaoyao.flowable.jpa;
import com.lanyuanxiaoyao.flowable.core.manager.FlowableManager;
import com.lanyuanxiaoyao.flowable.core.model.FlowableHandler;
import com.lanyuanxiaoyao.flowable.core.model.FlowableListener;
import com.lanyuanxiaoyao.flowable.test.TestFlowableManager;
import javax.annotation.Resource;
import org.springframework.boot.test.context.SpringBootTest;
@@ -21,7 +22,12 @@ public class TestSpringFlowableManager extends TestFlowableManager {
}
@Override
protected Class<? extends FlowableHandler> getAutomaticNodeClass() {
protected Class<? extends FlowableHandler> getHandler() {
return SimpleAutoAction.class;
}
@Override
protected Class<? extends FlowableListener> getListenerClass() {
return SimpleListener.class;
}
}