Reputation: 2136
I have a consumer that is throwing an exception and a bus with the following subscription:
ServiceBusFactory.New(sbc=>{
... removed for brevity...
sbc.Subscribe(s=>{
... removed for brevity...
var logger = LogManager.GetLogger("Faults");
s.Handler<IFault>(fault => logger.Error(JsonConvert.SerializeObject(fault)));
}
}
When an exception is thrown 5 times and it proceeds to a fault I can see my handler get called twice in two different threads.
I have no idea why, I'd like it to only happen once.
Maybe I'm going about this the wrong way. I want to be able to record that faults happened and have the ability to reprocess them. Is there something already built-in to MassTransit or RabbitMQ to handle this? Originally I was using MSMQ and that automatically tossed faulted messages into a related _error queue but I don't see those queues with RabbitMQ.
Upvotes: 0
Views: 2331
Reputation: 2136
I believe I found the problem... an earlier attempt to log faults meant registering a handler for each specific fault type, instead of the IFault object. Some of those exchanges were still registered in RabbitMQ. Deleting those resolved the problem.
Upvotes: 0
Reputation: 33278
I have confirmed, as shown in the Gist located at:
https://gist.github.com/phatboyg/8428147
That the fault events are only published once after the five consecutive failures in the consumer. This is with MT 2.9.5 from NuGet using either RabbitMQ or MSMQ.
Upvotes: 2
Reputation: 10547
I'm not aware of an issue around this being reported. I would work to reproduce this as a simple case and bring it to the mailing list http://groups.google.com/group/masstransit-discuss or submit an issue https://github.com/MassTransit/MassTransit/issues?state=open with the reproducible case.
Upvotes: 1