org.springframework.statemachine.listener.StateMachineListenerAdapter Java Examples
The following examples show how to use
org.springframework.statemachine.listener.StateMachineListenerAdapter.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: StateMachineConfiguration.java From spring-cloud-skipper with Apache License 2.0 | 6 votes |
@Override public void configure(StateMachineConfigurationConfigurer<SkipperStates, SkipperEvents> config) throws Exception { config .withConfiguration() .taskExecutor(skipperStateMachineTaskExecutor) // this is to simply add logging for state enters .listener(new StateMachineListenerAdapter<SkipperStates, SkipperEvents>() { @Override public void stateEntered(State<SkipperStates, SkipperEvents> state) { log.info("Entering state {}", state); } }) .transitionConflictPolicy(TransitionConflictPolicy.PARENT) .and() .withPersistence() .runtimePersister(stateMachineRuntimePersister); }
Example #2
Source File: AbstractFlowConfiguration.java From cloudbreak with Apache License 2.0 | 6 votes |
protected MachineConfiguration<S, E> getStateMachineConfiguration() { StateMachineConfigurationBuilder<S, E> configurationBuilder = new StateMachineConfigurationBuilder<>(ObjectPostProcessor.QUIESCENT_POSTPROCESSOR, true); StateMachineStateBuilder<S, E> stateBuilder = new StateMachineStateBuilder<>(ObjectPostProcessor.QUIESCENT_POSTPROCESSOR, true); StateMachineTransitionBuilder<S, E> transitionBuilder = new StateMachineTransitionBuilder<>(ObjectPostProcessor.QUIESCENT_POSTPROCESSOR, true); StateMachineListener<S, E> listener = new StateMachineListenerAdapter<>() { @Override public void stateChanged(State<S, E> from, State<S, E> to) { LOGGER.debug("state changed from {} to {}", from, to); } @Override public void eventNotAccepted(Message<E> event) { LOGGER.error("{} not accepted event: {}", getClass().getSimpleName(), event); } }; return new MachineConfiguration<>(configurationBuilder, stateBuilder, transitionBuilder, listener, new SyncTaskExecutor()); }
Example #3
Source File: AbstractFlowConfigurationTest.java From cloudbreak with Apache License 2.0 | 6 votes |
@Override protected MachineConfiguration<State, Event> getStateMachineConfiguration() { StateMachineConfigurationBuilder<State, Event> configurationBuilder = new StateMachineConfigurationBuilder<>(ObjectPostProcessor.QUIESCENT_POSTPROCESSOR, true); StateMachineStateBuilder<State, Event> stateBuilder = new StateMachineStateBuilder<>(ObjectPostProcessor.QUIESCENT_POSTPROCESSOR, true); StateMachineTransitionBuilder<State, Event> transitionBuilder = new StateMachineTransitionBuilder<>(ObjectPostProcessor.QUIESCENT_POSTPROCESSOR, true); StateMachineListener<State, Event> listener = new StateMachineListenerAdapter<State, Event>() { @Override public void eventNotAccepted(Message<Event> event) { throw new NotAcceptedException(); } }; return new MachineConfiguration<>(configurationBuilder, stateBuilder, transitionBuilder, listener, new SyncTaskExecutor()); }
Example #4
Source File: StateMachineConfig.java From spring-boot-tutorial with Creative Commons Attribution Share Alike 4.0 International | 5 votes |
@Bean public StateMachineListener<States, Events> listener() { return new StateMachineListenerAdapter<States, Events>() { @Override public void stateChanged(State<States, Events> from, State<States, Events> to) { System.out.println("State change to " + to.getId()); } }; }