Masstransit : request client always receive timeout even for a successful response from consumer

Viewed 754

I have setup my request client (which is a Console application) as shown in below code:

            try
            {
             var bus = Bus.Factory.CreateUsingAzureServiceBus(sbc => { sbc.Host(ServiceBusConnectionString); });

             await bus.StartAsync(); // This one is required to get response

             var client =
                bus.CreateRequestClient<MyRequest>(new Uri("queue:" + MyQueueName), TimeSpan.FromSeconds(50));
             var response = await client.GetResponse<MyRequestResponse>(myRequest); //we should get the response here
             Console.WriteLine(response.Message.mydata);
             await Task.Run(() => Console.ReadKey());

             await bus.StopAsync();
            }
            catch (Exception e)
            {
              Console.WriteLine(e);
              throw;
            }

I'm expecting response from Consumer but I always end-up on response timeout error.

Please note:

  • I can see that the Consumer is receiving message perfectly.Consumer response code:

      await context.RespondAsync(new MyRequestResponse(mydata));
    
  • If I send custom exception from Consumer , client catch the exception immediately after sending request.

Most probably I'm missing some silly configuration. Any help?

1 Answers

Make sure that your message types are correct, with the same type name (including namespace). If you receive the exception on the client, it would suggest that it is a message type issue (the logs would show it as a SKIP, and the response would be moved to the _skipped queue (which would be at the end of the long bus-xxx endpoint name for the request client.

Related