0

I couldn’t see anything to say this is normal behaviour, so excuse me if I am blind lol. I have seen something a bit odd when using MassTransit with request-response.

So I have multiple consumers on a service that listens for different requests to do simple tasks, like grab data from a database.

To test each consumer, I created a console app that executes a request for each consumer and checks the response.

What I am noticing is that the first request-response works fine, but when the code runs the next checks the response is received but the message is then moved to the skipped queue and deleted.

Here is the masstransit log for the 2nd request.

Send

[2021-05-14 10:27:11.812 DBG] (MassTransit.)-SEND rabbitmq://192.168.0.25/Ksrs.Requests:ConceptByConceptNoRequest d9360000-cf5b-480f-418f-08d916ba7421 Ksrs.Requests.ConceptByConceptNoRequest

Receive

[2021-05-14 10:28:00.203 DBG] (MassTransit.ReceiveTransport.)-RECEIVE rabbitmq://192.168.0.25/DESKTOP99KLG9M_Tests_bus_5r5yyygxmpry6jgtbdctpqurrb?temporary=true d9360000-cf5b-480f-2626-08d916ba7429 Ksrs.Response.ConceptResponse MassTransit.MessageHandler<Ksrs.Response.ConceptResponse>(00:00:00.0004546)

Skip?

[2021-05-14 10:28:41.361 DBG] (MassTransit.ReceiveTransport.)-SKIP rabbitmq://192.168.0.25/DESKTOP99KLG9M_Tests_bus_5r5yyygxmpry6jgtbdctpqurrb?temporary=true d9360000-cf5b-480f-ce25-08d916ba75f3

Don’t understand the skip when I still get the response, the response is as expected and the code can move on.

This is the client request and response code, which is pretty much the same for all my checks. The only difference being the request-response types.

static async Task<bool> GetByConceptNo(AutofacServiceProvider autoFac, short ksrsId, short conceptNo, ILogger logger)
    {
        var client = autoFac.GetService<IRequestClient<ConceptByConceptNoRequest>>();

        if (client is null) return false;

        Response<ConceptResponse> response;

        try
        {
            response = await client.GetResponse<ConceptResponse>(new ConceptByConceptNoRequest() {KsrsId = ksrsId, ConceptNo = conceptNo});

            logger.LogInformation("Received {Concept}.",response.Message.Concept);
        }
        catch (Exception e)
        {
            Console.WriteLine(e);
            return false;
        }
        return response.Message.Concept is not null;
    }

Just some notes:

Using Autofac as container.

Using Serilog for logging.

Using RabbitMQ (3.8.16) as message broker.

Anonymous Asked question May 14, 2021