By default when a message consumer in MassTransit throws an exception, the exception is caught by middleware in the transport (the ErrorTransportFilter to be exact), and the message is moved to an _error queue (prefixed by the receive endpoint queue name).
The exception details are stored as headers with the message for analysis and to assist in troubleshooting the exception.
Next to moving the message to an error, MassTransit also produces a Fault<T>
event. If the message headers specify a FaultAddress
, the fault is sent directly to that address. If the FaultAddress
is not present, but a ResponseAddress
is specified, the fault is sent to the response address. Otherwise, the fault is published, giving you the option to consume these fault messages if you want to:
However this can lead to a lot of extra exchanges that could be created.
If you don’t want to publish a Fault event, you can do this by setting the PublishFaults
property to false
in your MassTransit configuration: