I was playing with the fault tolerance of my system by turning off my NServiceBus endpoint and pushing messages into an MSMQ queue.
On startup of the endpoint (NServiceBus.Host.exe
) my messages are picked up (they are "Commands") and processed. The handlers that handle these commands also publish events. These events however aren't being handled. Does anyone know why this might be?
If I Send
a new command whilst the endpoint is running everything processes fine. The flow is this when the NServiceBus host is already running (correct):
UI ->
Command ->
MSMQ ->
Endpoint ->
CommandHandler ->
Event ->
EventHandler
This is the flow when the messages are sitting on the queue with no endpoint yet started:
--Endpoint not running -- ->
UI ->
Command ->
MSMQ ->
--Endpoint started-- ->
CommandHandler ->
Nothing.
The event handler is in the same assembly as the command handlers that are picking up the commands and processing them.
It just appears that the events aren't being published and/or handled during NService Bus' startup process. The messages are picked up and commands are handled.. but any events that are then published are not picked up by their listeners and are therefore not handled.
You should be aware that I have called PurgeOnStartup(false)
for the endpoint and the client. This works fine as far as I am aware.. because the commands on the queue are actually handled fine.. they just don't publish any events.