Queue Service “Process/Discard First Message” Mode

 

The queue service standard mode is to stop a queue’s processing whenever an error is encountered on any queue, keeping the problematic message on its original queue.  Thus, you may run into a case where stopping and re-starting the queue service just causes a queue service to stop since it may run into the same problem on the same message again.  If a decision to discard that problematic message, then this new feature is the way to do precisely that.

 

This feature will cause the queue service to act in the following manner when this special mode is activate:

    The first message (if any) on the Request and Retry queues for all queue servers will be processed.  There is no waiting for new messages to arrive at any queue.

    If the message is able to be handled successfully then it is so handled (added to the database, added to the document management system or logged as a third party error).

    If the message causes an error then the message is discarded.

    If the handling would cause this message to be placed onto the Retry queue, then the message is placed on the retry queue so long as the number of retry attempts has not been exhausted.  If they have, then the message is discarded instead.

    When a message is discarded, the following actions occur for that message only:

The reason (e.g. exception information) is written to the queue service log.

The message itself is written to the bad messages folder specified by the badMessageSavePath appSetting.

No email it sent, even if email is configured to be sent for messages that cause errors.

No message is sent to the error queue.

The message is removed from the request or retry queue that it came from.

The queue service will NEVER re-process this message again.

    Once there has been one attempt to read just the first message off of the request and the retry queues, the queue servers will stop.  Note that it may still take a couple of minutes to complete a single message processing cycle so do not assume that this mode is instantaneous (although it could be).  Review the log or use a queue viewer to see if the problem message(s) have been removed.

 

To activate this mode:

Place the following in your queue service MSSVLQueue.exe.config file, in the <appSettings> section:

 

<!-- Determines if first message in any queue servers (request or retry) will be discarded instead of being a queue stopper. -->

<add key="discardFirstMsgIfBad" value="True"/>

 

Customers are not to be made aware of this setting.  If you use it, it takes affect once the queue service is restarted.  After restarting the queue service, allow sufficient time for the queue service to complete a processing cycle before stopping the service (to do that, check the queue service log).  Remove this setting from the config file once the service is stopped.  Restart the service without this setting.

 

Note:  

The following is a new <appSettings> file setting that will be auto added to all customer MSSVLQueue.exe.config files.  This setting controls the folder in which a copy of the discarded message is written to.

 

<!-- The path to the directory containing bad messages that were discarded. -->

<add key ="badMessageSavePath" value="x:\SomeFolder"/>