MassTransit/MassTransit — Issue #80: Allow customization of error handling when consuming messages
Author: lowds
Created: 2012-02-01 21:04:18+00:00
State: open

As a developer of a message consumer
I want to be able to provide an alternative behavior for how MT handles errors when a consumer throws an exception
So that I can override the default behavior that moves a message to the error queue after one exception
And instead puts the message back on the queue to retry

This would allow a custom error handler to decide whether a message should be retried, for example due to a network blip or a database deadlock. Ideally the error handler would have access to the thrown Exception and the message type. This was discused briefly on the mailing list

http://groups.google.com/group/masstransit-discuss/browse_thread/thread/a7ab2754d4777ede

I'm thinking of an API similar to how you can add a custom transport factory, something like:

ServiceBusFactory.New(sbc =>
{
sbc.AddErrorHandler()
};

Not sure what interface T would be but it would allow someone to plug in any error handler they like, overriding a default implementation. In such circumstances an error handler could be decorated with other classes, such as alerting an ops team when a message is to be moved to a message queue.