views:

48

answers:

1

NServiceBus provides a timeout mechanism. From nservicebus.com:

The RequestTimeout method on the base class tells NServiceBus to send a message to another endpoint which will durably keep time for us ... There's a process that comes with NServiceBus called the Timeout Manager which provides a basic implementation of this functionality.

When time is up, the Timeout Manager sends a message back to the saga causing its Timeout method to be called with the same state object originally passed.

As I see it there is a possibility that the timeout is triggered even though the message has been delivered to the receiver (the reply got stuck somewhere for example).

How do I design my application in such a way that my application will behave correctly regardless if the message made it to the receiver or not.

+1  A: 

If the Client sends a message to the Server and then requests a Timeout, the state of the request will be stored. If the Timeout message is received by the Client prior to the reply from the Server then you can compare the state returned by the Timeout to the current state and see that the Server has not replied and decide what to do. If the request is no longer valid, you might ignore the reply. If that is the case, you may want to look at the "TimeToBeReceived" attribute for the Server message. It will throw away messages it can't receive in the designated time.

Adam Fyles