I have a input queue which runs fine. Sometimes a message gets on the error queue. Now i want to be able inspect these messages and maybe forward them to the input queue again if I know this particular message will pass.
How do I start with inspecting the error queue? Are there any best practices?
I can't just do a .CreateBus().Start()
because this will trigger the handlers from the normal handlers.
The way you inspect queues and the options you get depends on the chosen transport.
If you're using Rebus with MSMQ, the easiest way to inspect your queues (input queues, error queues, MSMS dead-letter queues) and retry delivery of failed messages is to fire up Rebus Snoop. Rebus has a ReturnToSourceQueue CLI tool for MSMQ as well.
If you're using Azure Service Bus, I can recommend Paolo Salvatori's Service Bus Explorer which I've used a little bit myself on a few projects.
With RabbitMQ, I usually use RabbitMQ's built-in web management plugin to inspect queues, and then Rebus comes with a ReturnToSourceQueue CLI tool for RabbitMQ as well.
If you're using SQL Server, I can recommend firing up SQL Server Management Studio and getting your SQL-fu on ;)
If you want to code something that does some kind of automatic forwarding or handling of failed messages, I can recommend using Rebus' transport implementations (i.e. MsmsMessageQueue
(along with MsmqUtil
), RabbitMqMessageQueue
, AzureServiceBusMessageQueue
, etc.) to handle the receiving and sending of raw transport messages - it's an approach that I've used several times myself to e.g. implement crude second level retries mechanisms and forwarding and archival of failed messages etc.