Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
ericmiranda7 opened this issue Feb 27, 2025 · 0 comments
Labels
status/need-triage Team needs to triage and take a first look

Comments

@ericmiranda7
Copy link

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?

@github-actions github-actions bot added the status/need-triage Team needs to triage and take a first look label Feb 27, 2025
@ericmiranda7 ericmiranda7 changed the title Anonymous transitions the last sent event as the Message in StateMachineInterceptor Anonymous transitions contain the last sent event as the Message in StateMachineInterceptor Feb 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status/need-triage Team needs to triage and take a first look
Projects
None yet
Development

No branches or pull requests

1 participant