0
votes

A similar type of question has already been asked here

Here is my Requester code

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

            await bus.StartAsync();

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

            await bus.StopAsync();

I have noticed that , if any error happened into the consumer, It never hit my Fault consumer.

On the other hand, If I send a message through ISendEndPoint (as shown in below code) , The Fault consumer is working perfectly.

        IServiceProvider serviceProvider = SetupServiceCollection();
        var bus = serviceProvider.GetRequiredService<IBus>();
        var endpoint = await bus.GetSendEndpoint(new Uri("queue:" + TopicName));
        await endpoint.Send(myRequest);

Message type and Namespace has been configured correctly. Is there any settings I'm missing for request/response pattern?

1

1 Answers

0
votes

As explained in the answer to the question you linked, faults are not published when a ResponseAddress is present (which is necessary for request/response) and are instead sent directly to the response address. The fault is subsequently received by the request client and used to throw an exception on the original request Task.

There isn't any setting missing, it's just how it works.