persist actions and transitions with EnumStateMachineConfigurerAdapter

39 Views Asked by At

How to save Action and transition using spring statemachine 3.2.1 ??

I tried to follow the guides and implement persistence of actions and transitions. i implemented the StateMachineRuntimePersister but only state machine persist sucessfully. and the action and transitions table are empty.

private StateMachineRuntimePersister<States, Events, String> stateMachineRuntimePersister;

i tried to implement StateMachineModelFactory below but it support only Strings .

@Autowired
private StateRepository<? extends RepositoryState> stateRepository;

@Autowired
private TransitionRepository<? extends RepositoryTransition> transitionRepository;

@Override
public void configure(StateMachineModelConfigurer<States, Events> model)
        throws Exception {
    model
            .withModel()
            .factory(modelFactory());
}

@Bean
public StateMachineModelFactory<States, Events> modelFactory() {
    return new RepositoryStateMachineModelFactory(stateRepository, transitionRepository);
}
0

There are 0 best solutions below