Database Reference
In-Depth Information
Timeout messages
There is the need in ESBs to set timers for various messages to ensure that they do not live
in the services and queues for an infinite period of time. Even most production databases
require an archive and purging schedule to clean up old data that may not be relevant any-
more. Since messages live on queues as a form of data, there also needs to be archiving and
purging plans to revisit any messages that could reside in the system when there is no
longer a need for them to do so. For this reason, as NSB is all about automation, timers can
be set to relook at a message to check its status or even delete some resident messages that
are no longer needed.
Sagas support timeout messages that are set using the RequestTimeout function of a
saga. This code will look as follows:
TimeoutMessage is a user-defined message from the interface IMessage that will be
sent when the timer is expired. In this case, it will be 60 seconds. A timeout message will
be received on the saga instance like any other message handler, and the code is put in the
timeout message handler to perform any cleanup required to get rid of the message inform-
ation that is no longer required. The timeout message may be an empty message:
The saga process does not have to be used to set timeouts in NSB. For similar tasks, as the
one described previously, we may also use NServiceBus.Schedule as well.
In this section, we will be using the TimeoutManager solution with the following pro-
jects:
TimeoutManager : This project will perform several timeout functions.
Running the TimeoutManager project, we will be presented with a couple of options:
Search WWH ::




Custom Search