Print/See the sequence of events/command a SagaTestFixture produced


I have a Saga(TestFixture) that produces several events and commands. And although the test works OK, I like to see some kind of timeline of what’s been executed after the test has run.

1 -> Saga started with EventX
2 -> Saga dispatched Command1
3 -> Saga continued (handled) with IntermediateEvent1
4 -> Saga continued (handled) with IntermediateEvent2
5 -> Saga dispatch EndCommand and finished (i.e. @EndSaga)

I know I can add (debug) logging in all my handlers, but I’d like to know if there’s some other way to do this without having all kinds of extra log statements in my code. I’m only interested in the execution plan from the test.



Hi Danny,

Would you could do is register MessageDispatchInterceptors to an stub EventBus and CommandBus, which you then in turn register to your SagaTestFixture, by calling SagaTestFixture#registerResource(Object).
The MessageDispatchInterceptors you’d register can in turn log every message coming through, and as such providing you with the log statements you’re looking for.
You could for example check the EventLoggingInterceptor, and make a small adjustment to it to have a general MessageLoggingInterceptor.

Would that proof to be a worthy solution in your use case Danny?