Exception Handling

Exception handling refers to exceptions that are thrown from workflows as well as responses from the Anthology API services when the Windows Communication Foundation (WCF) service returns validation messages.

Workflow Design Requires Exception Handling

The user who creates workflows is responsible for catching exceptions. Any unexpected and uncaught exceptions will abort workflows. For the guidelines on exception handling within workflows, refer to Coding for Activity Errors.

Exception Message Queues

Workflow exception messages are queued. Queues ensure that reliable messaging can occur between a client and a service, even if the service is not available at the time of communication.

Anthology uses dead-letter queue and poison message handling provided by the WCF framework. For more information, see http://msdn.microsoft.com/en-us/library/ms789035(v=vs.110).aspx.

If an error is found in a workflow, the message queue flags exceptions as EXTERNAL_DeadLetterQueue.

A log file on the application server provides detailed information about Compiler errors in the workflow.

The failed messages in the dead-letter queue are tried again. If the exception cannot be resolved, the first entry is cleared from the dead letter queue. This ensures that the service broker is not locked in case of an exception. Users can retry the transaction after the error is cleared.

In addition, the Service Broker queue processor code implements a Trace.WriteLine mechanism to handle failed messages:

/// <summary>
/// Handle failed messages
/// </summary>
/// <param name="message"></param>
/// <param name="messageType"></param>
/// <param name="con"></param>
/// <param name="errorInfo"></param>
public static void SaveFailedMessage(string message, string messageType, SqlConnection con, Exception errorInfo)
{
Trace.WriteLine("CVueExternalMessageProcessor Received Failed Message");
}

The default behavior of Service Broker is to disable a queue after the same message has thrown an exception five times. Anthology provides a setting in the config file that prevents shutting down the queue.

     <setting name="ShutdownQueueOnError" serializeAs="String">
<value>False</value>
</setting>

When this setting is set to True, the queue gets disabled. When this setting is set to False, the queue does not get disabled. False is the recommended setting.