I started to get a weird problem that I can’t figure out.
I’ve been starting to make our client more asynchronous. In during that work the endpoint instance stopped returning a reply.
I can see that the microserver sends the reply, and if I stop the client the messages goes to the error queue (but not before). It gets the typical “No handler could be found” message.
NSB config:
var endpointName = $"{_clientEndpointNameDefault}.Control2";
var endpointConfiguration = new EndpointConfiguration(endpointName);
endpointConfiguration.DisableFeature<AutoSubscribe>();
endpointConfiguration.UsePersistence<InMemoryPersistence>();
endpointConfiguration.MakeInstanceUniquelyAddressable("Callbacks");
endpointConfiguration.EnableCallbacks();
endpointConfiguration.Recoverability().Delayed(x => x.NumberOfRetries(0));
endpointConfiguration.Recoverability().Immediate(x => x.NumberOfRetries(0));
var settings = JsonSettingsFactory.Create();
var serialization = endpointConfiguration.UseSerialization<NewtonsoftSerializer>();
serialization.Settings(settings);
var transport = endpointConfiguration.UseTransport<RabbitMQTransport>();
transport.ConnectionString(GetQueueConnectionString());
transport.UseConventionalRoutingTopology();
And the simple call:
var options = new SendOptions();
options.SetDestination(RoutingModuleName);
var query = new GetRouteTable();
var routes = await endpoint.Request<GetRouteTableResult>(query, options).ConfigureAwait(false);
From the receiving microservice log:
2020-02-20 09:44:55,767 DEBUG@20 [(null)] [LogInboundMessagesHandler:0] [218a976d-d781-482b-85da-ab6700a0a7c1] EnclosedMessageTypes: GetRouteTable;LAIV.Foundation.Contracts;v1.0.6.0, ReplyToAddress: LAIV.Client.TRV-PC84655.Control2-Callbacks, CorrelationId: 218a976d-d781-482b-85da-ab6700a0a7c1, OriginatingMachine: TRV-PC84655, OriginatingEndpoint: LAIV.Client.TRV-PC84655.Control2, NServiceBus.Version: 7.2.0, TimeSent: 2020-02-20 09:44:55:801963 Z
2020-02-20 09:44:55,767 DEBUG@20 [(null)] [LogOutboundMessagesHandler:0] [d2d83dce-76db-430d-b3f5-ab6700a0a7db] EnclosedMessageTypes: GetRouteTableResult;LAIV.Foundation.Contracts;v1.0.6.0, ReplyToAddress: Routing, CorrelationId: 218a976d-d781-482b-85da-ab6700a0a7c1, OriginatingMachine: TRV27124, OriginatingEndpoint: Routing
Update:
If I add a simple handler:
public class Handler : IHandleMessages<GetRouteTableResult>
{
public Task Handle(GetRouteTableResult message, IMessageHandlerContext context)
{
Console.WriteLine("Got it!");
return Task.CompletedTask;
}
}
It will receive the message (the correlation id in the request and reply matches), so the message is delivered to the endpoint.
Update 2
I`ve also tried:
endpoint.Request<GetRouteTableResult>(query, options)
.ContinueWith(x => { Console.WriteLine("gotit!"); });
await Task.Delay(5000).ConfigureAwait(false);
The delay goes through, but ContinueWith do not.
Can you help me figure out why it doesn’t return when the reply arrives? Is there any way that I can diagnose why the reply isn’t used by Request<T>
?