Skip to content

Anonymous transitions contain the last sent event as the Message in StateMachineInterceptor #1182

Open
@ericmiranda7

Description

@ericmiranda7

I have a flow that looks like

Source(A).Target(B).Event(AB) // event triggered transition
Source(B).Target(C) // anonymous transition
Source(C).Target(D) // anonymous transition

I have an Interceptor class that looks like

public class StateMachineEventInterceptor extends StateMachineInterceptorAdapter < States, Events > {
    public StateMachineEventInterceptor() {}

    @Override
    public void postStateChange(State < States, Events > state, Message < Events > message, Transition < States, Events > transition,
        StateMachine < States, Events > stateMachine, StateMachine < States, Events > rootStateMachine) {
        executorService.submit(() - > {
                if (message != null) { // persist state, event in an audit table }
            )
        }
    }
}

However, it seems like Message will always contain the last event sent to the statemachine, which in this case
is event AB. Is there any way I can know whether the transition was anonymous so that I can persist a null in the event column of my audit table?

Metadata

Metadata

Assignees

No one assigned

    Labels

    status/need-triageTeam needs to triage and take a first look

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions