I have a UnitOfWork message module. When NH throws an exception after
multiple retries the transaction is aborted and RSB host chokes and
has to shut down. Here is the module I have:
public class UnitOfWorkMessageModule : IMessageModule
{
public void Init(ITransport transport)
{
transport.MessageArrived += transport_MessageArrived;
transport.MessageProcessingCompleted +=
transport_MessageProcessingCompleted;
}
public void Stop(ITransport transport)
{
transport.MessageArrived -= transport_MessageArrived;
transport.MessageProcessingCompleted -=
transport_MessageProcessingCompleted;
}
bool transport_MessageArrived
(Rhino.ServiceBus.Impl.CurrentMessageInformation arg)
{
UnitOfWork.Start();
return false;
}
void transport_MessageProcessingCompleted
(Rhino.ServiceBus.Impl.CurrentMessageInformation obj, Exception
exception)
{
if(exception!=null)
{
Log.For(this).Error("An error occured on
message process
completion:" + exception);
}
else
{
try
{
if(UnitOfWork.IsStarted)
{
UnitOfWork.Current.Dispose();
}
}
catch (Exception ex)
{
Log.For(this).Error(ex.ToString());
throw;
}
}
}
}
On May 27, 5:30 pm, Ayende Rahien <[email protected]> wrote:
> Any error that occurs during message processing is going to cause the
> following:a) the current transaction will abort
> b) the message will be put back into the queue if the queue is
> not transactional
> c) the error will be logged
> d) if the message failed more than N amount, the message and the error will
> be moved to errors sub queue
>
> What you are seeing is the as-designed behavior.
> What are you trying to do? What is the problem?
>
> On Wed, May 27, 2009 at 11:56 PM, Mike Nichols
> <[email protected]>wrote:
>
>
>
> > In one of my IMEssageModule implementations I am rethrowing any
> > exception which occurs, but this breaks the Rhino Queues transport
> > since it seems to make the transaction abort.
>
> > Should transaction errors be swallowed in RQ Transport like the other
> > processing errrors to keep the transport from shutting down and,
> > consequently, shutting down the application?
> > If so, I'll move the try..catch to encompass the transaction scope in
> > the RQ transport receieve call.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Rhino Tools Dev" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/rhino-tools-dev?hl=en
-~----------~----~----~----~------~----~------~--~---