Search in sources :

Example 1 with StateMachineProcessHandler

use of io.seata.saga.engine.pcext.StateMachineProcessHandler in project seata by seata.

the class DefaultStateMachineConfig method createProcessorController.

protected ProcessControllerImpl createProcessorController(ProcessCtrlEventPublisher eventPublisher) throws Exception {
    StateMachineProcessRouter stateMachineProcessRouter = new StateMachineProcessRouter();
    stateMachineProcessRouter.initDefaultStateRouters();
    loadStateRouterInterceptors(stateMachineProcessRouter.getStateRouters());
    StateMachineProcessHandler stateMachineProcessHandler = new StateMachineProcessHandler();
    stateMachineProcessHandler.initDefaultHandlers();
    loadStateHandlerInterceptors(stateMachineProcessHandler.getStateHandlers());
    DefaultRouterHandler defaultRouterHandler = new DefaultRouterHandler();
    defaultRouterHandler.setEventPublisher(eventPublisher);
    Map<String, ProcessRouter> processRouterMap = new HashMap<>(1);
    processRouterMap.put(ProcessType.STATE_LANG.getCode(), stateMachineProcessRouter);
    defaultRouterHandler.setProcessRouters(processRouterMap);
    CustomizeBusinessProcessor customizeBusinessProcessor = new CustomizeBusinessProcessor();
    Map<String, ProcessHandler> processHandlerMap = new HashMap<>(1);
    processHandlerMap.put(ProcessType.STATE_LANG.getCode(), stateMachineProcessHandler);
    customizeBusinessProcessor.setProcessHandlers(processHandlerMap);
    Map<String, RouterHandler> routerHandlerMap = new HashMap<>(1);
    routerHandlerMap.put(ProcessType.STATE_LANG.getCode(), defaultRouterHandler);
    customizeBusinessProcessor.setRouterHandlers(routerHandlerMap);
    ProcessControllerImpl processorController = new ProcessControllerImpl();
    processorController.setBusinessProcessor(customizeBusinessProcessor);
    return processorController;
}
Also used : DefaultRouterHandler(io.seata.saga.proctrl.handler.DefaultRouterHandler) CustomizeBusinessProcessor(io.seata.saga.proctrl.process.impl.CustomizeBusinessProcessor) StateMachineProcessHandler(io.seata.saga.engine.pcext.StateMachineProcessHandler) HashMap(java.util.HashMap) StateMachineProcessRouter(io.seata.saga.engine.pcext.StateMachineProcessRouter) ProcessRouter(io.seata.saga.proctrl.ProcessRouter) ProcessControllerImpl(io.seata.saga.proctrl.impl.ProcessControllerImpl) StateMachineProcessRouter(io.seata.saga.engine.pcext.StateMachineProcessRouter) DefaultRouterHandler(io.seata.saga.proctrl.handler.DefaultRouterHandler) RouterHandler(io.seata.saga.proctrl.handler.RouterHandler) ProcessHandler(io.seata.saga.proctrl.handler.ProcessHandler) StateMachineProcessHandler(io.seata.saga.engine.pcext.StateMachineProcessHandler)

Aggregations

StateMachineProcessHandler (io.seata.saga.engine.pcext.StateMachineProcessHandler)1 StateMachineProcessRouter (io.seata.saga.engine.pcext.StateMachineProcessRouter)1 ProcessRouter (io.seata.saga.proctrl.ProcessRouter)1 DefaultRouterHandler (io.seata.saga.proctrl.handler.DefaultRouterHandler)1 ProcessHandler (io.seata.saga.proctrl.handler.ProcessHandler)1 RouterHandler (io.seata.saga.proctrl.handler.RouterHandler)1 ProcessControllerImpl (io.seata.saga.proctrl.impl.ProcessControllerImpl)1 CustomizeBusinessProcessor (io.seata.saga.proctrl.process.impl.CustomizeBusinessProcessor)1 HashMap (java.util.HashMap)1