Why is the flow in the HandleMessageEvent sometimes null?

Hi @Jordi , ah, I see! The exception is thrown because the flow is null.
Back to @Aaron 's comment, your .dispose() is rather brutal. Not only are you closing the flow, you are also disconnecting (and disposing of) the session. Unless you have very good performance reasons, use the same session for all your flows: opening a session for every flow like this is very expensive. What’s more, you’re then disposing of the context - again, this is uncessary.
This is speculation, but what might be happening is some kind of race condition between consumer1 being closed, consumer 2 starting, then the underlying session or context being disposed.
I recommend trying the 1 session, 1 context approach, and seeing if that fixes your problem.