Error/Exception handling in Mass Transit

2,097 views
Skip to first unread message

Daring Tang

unread,
Dec 10, 2013, 12:25:07 PM12/10/13
to masstrans...@googlegroups.com
What is the proper way to handle exception/error in Mass Transit in a message consumer?

Suppose I have a message containing a data to be persisted to database table.  In the event when failure due to record lock, service unavailability or timeout or any other error that prevents the completion of this transaction.  I'd like to have the service to retry x number of times with certain time interval.

How would I achieve this?

Thanks,

Cullen

Chris Patterson

unread,
Dec 10, 2013, 11:39:52 PM12/10/13
to masstrans...@googlegroups.com
MT will automatically retry delivery of the message to your consumer five times before moving the message to an error queue. Just throw the exception within the consumer and it kicks in automatically.


--
You received this message because you are subscribed to the Google Groups "masstransit-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to masstransit-dis...@googlegroups.com.
To post to this group, send email to masstrans...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/masstransit-discuss/f6ff4382-8fc5-4085-989c-166f0ec4b5f2%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Dru Sellers

unread,
Dec 11, 2013, 11:09:37 AM12/11/13
to masstrans...@googlegroups.com

Daring Tang

unread,
Dec 11, 2013, 12:39:14 PM12/11/13
to masstrans...@googlegroups.com
Thanks Chris and Dru!

Should error queue be treated just like any other queue?  In other words, should I create an error queue consumer or is there some other way to handle it?  I'm not able to find the documentation on that.

Travis Smith

unread,
Dec 11, 2013, 1:27:08 PM12/11/13
to masstrans...@googlegroups.com
It's kinda an application concern. What would you want to do with those messages that would be meaningful? Dru wrote the bus driver which could be used to restore those messages to the main queue if you want to retry them after whatever has been resolved. 

We actually have a workflow in the support tools that allows the support people make edits to the message data before returning it to the queue if needed. Otherwise it just goes back. 

-Travis


On Wed, Dec 11, 2013 at 12:39 PM, Daring Tang <darin...@gmail.com> wrote:
Thanks Chris and Dru!

Should error queue be treated just like any other queue?  In other words, should I create an error queue consumer or is there some other way to handle it?  I'm not able to find the documentation on that.

--
You received this message because you are subscribed to the Google Groups "masstransit-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to masstransit-dis...@googlegroups.com.
To post to this group, send email to masstrans...@googlegroups.com.

Daring Tang

unread,
Dec 11, 2013, 5:46:36 PM12/11/13
to masstrans...@googlegroups.com
You're right.  It all depends on the execution context in which the error occurred.  But I'd like to send an email notification to the support that the error happened.


On Wednesday, December 11, 2013 12:27:08 PM UTC-6, Travis Smith wrote:
It's kinda an application concern. What would you want to do with those messages that would be meaningful? Dru wrote the bus driver which could be used to restore those messages to the main queue if you want to retry them after whatever has been resolved. 

We actually have a workflow in the support tools that allows the support people make edits to the message data before returning it to the queue if needed. Otherwise it just goes back. 

-Travis


On Wed, Dec 11, 2013 at 12:39 PM, Daring Tang <darin...@gmail.com> wrote:
Thanks Chris and Dru!

Should error queue be treated just like any other queue?  In other words, should I create an error queue consumer or is there some other way to handle it?  I'm not able to find the documentation on that.

--
You received this message because you are subscribed to the Google Groups "masstransit-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to masstransit-discuss+unsub...@googlegroups.com.

To post to this group, send email to masstrans...@googlegroups.com.

Eugene Tolmachev

unread,
Dec 19, 2013, 9:05:20 AM12/19/13
to masstrans...@googlegroups.com
Did you try subscribing your mailing service to Fault<YourMessageTypeHere>?
Reply all
Reply to author
Forward
0 new messages