Example usage for org.springframework.statemachine.event StateMachineEventPublisher publishTransition

List of usage examples for org.springframework.statemachine.event StateMachineEventPublisher publishTransition

Introduction

In this page you can find the example usage for org.springframework.statemachine.event StateMachineEventPublisher publishTransition.

Prototype

void publishTransition(Object source, Transition<?, ?> transition);

Source Link

Document

Publish a transition event.

Usage

From source file:org.springframework.statemachine.support.StateMachineObjectSupport.java

protected void notifyTransition(StateContext<S, E> stateContext) {
    try {/*from w  w w. j  ava  2s.  c  o  m*/
        stateMachineHandlerCallHelper.callOnTransition(getBeanName(), stateContext);
        stateListener.transition(stateContext.getTransition());
        stateListener.stateContext(stateContext);
        if (contextEventsEnabled) {
            StateMachineEventPublisher eventPublisher = getStateMachineEventPublisher();
            if (eventPublisher != null) {
                eventPublisher.publishTransition(this, stateContext.getTransition());
            }
        }
    } catch (Throwable e) {
        log.warn("Error during notifyTransition", e);
    }
}