Joe DeCock
Joe DeCock

Reputation: 80

MassTransit - Running code when messages sent to error queue

In MassTransit, how can I notify users that an error has occurred after the retry policy stops retrying? Can I run custom code when messages are sent to the error queue, maybe as some kind of middleware? I'm using the MassTransit 3.0.11 beta with RabbitMQ.

Upvotes: 1

Views: 2180

Answers (1)

Chris Patterson
Chris Patterson

Reputation: 33298

Are you doing a request/response conversation, where a client is sending a request and the service is failing and moving the request to the error queue?

If so, you can handle the fault (which is sent back to the requestor when an exception occurs) as part of the request/response. Take a look at:

https://github.com/MassTransit/Sample-RequestResponse

The request client will automatically wrap this and throw an exception if the service faults the request.

If you are doing something different, please include a code snippet.

Upvotes: 1

Related Questions