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

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

Introduction

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

Prototype

void publishStateChanged(Object source, State<?, ?> sourceState, State<?, ?> targetState);

Source Link

Document

Publish a state changed event.

Usage

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

protected void notifyStateChanged(StateContext<S, E> stateContext) {
    try {/*  w ww .  j  a va  2s . c  om*/
        stateMachineHandlerCallHelper.callOnStateChanged(getBeanName(), stateContext);
        stateListener.stateChanged(stateContext.getSource(), stateContext.getTarget());
        stateListener.stateContext(stateContext);
        if (contextEventsEnabled) {
            StateMachineEventPublisher eventPublisher = getStateMachineEventPublisher();
            if (eventPublisher != null) {
                eventPublisher.publishStateChanged(this, stateContext.getSource(), stateContext.getTarget());
            }
        }
    } catch (Throwable e) {
        log.warn("Error during notifyStateChanged", e);
    }
}