我倾向于SSM,打击是我的演示配置:Spring Statemachine is statefull?
@Override
public void configure(StateMachineConfigurationConfigurer<States, Events> config) throws Exception {
config.withConfiguration()
.autoStartup(true)
.listener(listener());
}
@Override
public void configure(StateMachineStateConfigurer<States, Events> states) throws Exception {
states.withStates()
.initial(States.S_1)
.state(States.S_1, myAction(), null)
.end(States.S_END)
.states(EnumSet.allOf(States.class));
}
@Override
public void configure(StateMachineTransitionConfigurer<States, Events> transitions) throws Exception {
transitions
.withExternal()
.source(States.S_1).target(States.S_2).event(Events.E1).action(myAction());
}
我发送两个事件的机器,但它onece运行。
stateMachine.sendEvent(Events.E1);
stateMachine.sendEvent(Events.E1);
ssm是否有状态,我该如何让它运行无状态?
我只是想用它来定义我的业务流程。
我的意思是我想要SSM定义我的业务程序,如“创建一个订单”,需要首先保存订单信息数据库,第二次发送订单确定电子邮件,第三个nofify处理器流程订单。如果创建另一个订单,它将运行相同的过程。但是,如果状态机改变了状态,它就不能这样做。 – gpengtao