handler - why PersistStateMachineHandler added listener,but listener don't work well -
i created statemachine statemachinefactory
, statepersist
handler. in document, executing handler.handleeventwithstate
method can trigger listener, code run failes. has idea why?
@override public void submit(string machineid, string curstatus,long[] ids) { statemachine<string, string> machine = statemachinefactory.getstatemachine(machineid); persiststatemachinehandler handler = new persiststatemachinehandler(machine); handler.addpersiststatechangelistener(new testlistener(jdbctemplate)); system.out.println("状态机是否终结:" + machine.iscomplete() + "machine-uuid:"+machine.getuuid()); state<string, string> s = machine.getinitialstate(); system.out.println("状态id:" + s.getid() ); if(machine.iscomplete()) { machine.start(); } machine.sendevent("start"); system.out.println("状态机是否终结:" + machine.iscomplete()+ machine.getstate().getid()); handler.handleeventwithstate(messagebuilder.withpayload("start").setheader("ids", ids).build(), curstatus); }
Comments
Post a Comment