Deferral and Recovery as an alternative Error Strategy

Error MessageBoxes and Exits from the application code is not the only way to
handle errors in applications. If there is a chance that the error conditions
can clear up such as network temporary outages, then Deferral and Recovery may be another way to go. Here I will describe a Deferral and Recovery method used in the Genius Outlook Plug-in.

Deferral requires that the current state of the transaction be described and stored in an application space. In this application the state is described using XML and a very simple schema. A simplified finite state machine interprets the state information and executes the protocol elements of the transaction keeping a log of each step. The log itself is an XML based record of the transaction and can be used for diagnostic analysis and customer support.

A job table is kept of pending and Deffered jobs some sample XML follows below:

Items posted but not sent are deferred by definition. Recovery may ocurr at any time the resources for the transaction are available. Recovery may be scheduled by indicating a <ScheduledTime Time Value<ScheduledTime /> entry in the XML job table record. The transaction record keeps the infromation about the progress of the transaction and whether it has failed at any point.

When the error condition clears up the job can be recovered and the upon sucessful completion the job status table is updated.

Time-outs or retries can be added to limit the number of attempts to complete the job. When the job is completed. An Archive folder can be created to store completed job records on a regular basis. The folders can be cleaned on scheduled basis.