Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Masstransit one fault consumer for all fault message

Tags:

masstransit

How to have one generic consumer that handle all Fault Messages ?

Do I need to register Fault Consumer for each of my fault messages?

like image 896
ArDumez Avatar asked Oct 23 '25 16:10

ArDumez


1 Answers

Why not consume Fault?

public class WantAllFaultsGimmeThem : IConsumer<Fault>
{
    public async Task Consume(ConsumeContext<Fault> context)
    {
        // whatever you want to do here
    }
}

The only issue is that the Message is not part of this interface and therefore it will not be even deserialised. so you will not have access to the message, only to the message id.

like image 87
Alexey Zimarev Avatar answered Oct 27 '25 02:10

Alexey Zimarev