—> End point 1
{ //Handler
try
{
Logic 1
Send command to Endpoint2
Logic 2
}
catch(Exception ex)
{
throw ex;
}
}
—> End point 2 (Currently Unrechable)
1). We are sending command from controller to Endpoint1.
2). Command will be handled by a particular handler at endpoint1.
3). Now we are trying to sending other command to Endpoint2 (From inside same Handler of endpoint1)
4). Currently Endpoint2 is unreachable
5). Problem: We are unable to get/catch any information/exception, due to this the handler call is stuck in retry loop and all the logic are being executing again and again.
I’ve been searching for something to help point us in the right direction on how we can handle such kind of scenario in .net core application.
Welcome to the Particular discussion group. I’m not sure I fully understand the scenario you are describing:
From an endpoint, there is no way to know what’s happening in another endpoint, and that’s a good thing, it reduces coupling. That being said, when endpoint 1 sends the command to endpoint 2 the message is dispatched to the queueing system and from there it’s managed by the broker/queues you are using.
If endpoint 2 is unavailable the message will sit in the endpoint 2 input queue waiting to be processed. If endpoint 2 fails to process it’ll be retried a few times (more info) before eventually being moved to the error queue.
Since NServiceBus 6 messages are not send immediately but batched. If Logic 2 fails, the message will not get send and retrying the message will return in Logic 1 to be executed again.