use of io.seata.saga.proctrl.ProcessType in project seata by seata.
the class DefaultRouterHandler method route.
@Override
public void route(ProcessContext context) throws FrameworkException {
try {
ProcessType processType = matchProcessType(context);
if (processType == null) {
if (LOGGER.isWarnEnabled()) {
LOGGER.warn("Process type not found, context= {}", context);
}
throw new FrameworkException(FrameworkErrorCode.ProcessTypeNotFound);
}
ProcessRouter processRouter = processRouters.get(processType.getCode());
if (processRouter == null) {
LOGGER.error("Cannot find process router by type {}, context = {}", processType.getCode(), context);
throw new FrameworkException(FrameworkErrorCode.ProcessRouterNotFound);
}
Instruction instruction = processRouter.route(context);
if (instruction == null) {
LOGGER.info("route instruction is null, process end");
} else {
context.setInstruction(instruction);
eventPublisher.publish(context);
}
} catch (FrameworkException e) {
throw e;
} catch (Exception ex) {
throw new FrameworkException(ex, ex.getMessage(), FrameworkErrorCode.UnknownAppError);
}
}
use of io.seata.saga.proctrl.ProcessType in project seata by seata.
the class CustomizeBusinessProcessor method process.
@Override
public void process(ProcessContext context) throws FrameworkException {
ProcessType processType = matchProcessType(context);
if (processType == null) {
if (LOGGER.isWarnEnabled()) {
LOGGER.warn("Process type not found, context= {}", context);
}
throw new FrameworkException(FrameworkErrorCode.ProcessTypeNotFound);
}
ProcessHandler processor = processHandlers.get(processType.getCode());
if (processor == null) {
LOGGER.error("Cannot find process handler by type {}, context= {}", processType.getCode(), context);
throw new FrameworkException(FrameworkErrorCode.ProcessHandlerNotFound);
}
processor.process(context);
}
use of io.seata.saga.proctrl.ProcessType in project seata by seata.
the class CustomizeBusinessProcessor method route.
@Override
public void route(ProcessContext context) throws FrameworkException {
ProcessType processType = matchProcessType(context);
if (processType == null) {
if (LOGGER.isWarnEnabled()) {
LOGGER.warn("Process type not found, the process is no longer advanced, context= {}", context);
}
return;
}
RouterHandler router = routerHandlers.get(processType.getCode());
if (router == null) {
LOGGER.error("Cannot find router handler by type {}, context= {}", processType.getCode(), context);
return;
}
router.route(context);
}
Aggregations