Introduction

BizTalk Server stores messages associated with suspended pipelines in the MessageBox database. If a failure occurs in the pipeline, BizTalk Server suspends the instance of a message. There are two types of suspended service instances:

  • Suspended instances that you can resume
  • Suspended instances that you cannot resume. For example, if an instance is corrupt or RFR

Depending on the cause of the suspension, you may be able to resume services that BizTalk Server suspends -- for example, if an orchestration hits a Suspend shape, or if a transport was unable to deliver a message, BizTalk Server does not automatically remove suspended instances that you cannot resume from the MessageBox database. You can choose to save a service instance to disk before removing it from the suspended queue.

Impact of Suspended Messages

Each suspended message is going to be stored into the suspended queue for that host (See Host queue tables post) this implies:

  • Spool table will have references for that messages
  • Each internal stored procedure that the BizTalk engine runs has to “filter” and execute even more records than usual which in a 100.000 execution will have a negative impact (even more in a low latency scenario in which the MaxReceiveInterval (BizTalk 2006) or Pooling Intervals (BizTalk 201x) settings are aggressively reduced)
  • Throttling due to message count in database threshold will be affected since suspended messages are included in the Message count in database calculation (because of the Spool size), throttling of message publishing can occur even if the BizTalk server is experiencing low or no load.

Why this script?

This script is intended to be as a tool to deal with BizTalk suspended messages, especially if the environment is suffering with massive suspended messages.

Important supportability information: This script may not be supported by Microsoft as is going to be coded by you, Microsoft has not tested it.

Functionality

With this script you will be able to:

  • Terminate or resume a set of suspended messages that match:
    • A suspended error code (mandatory)
    • BizTalk host name (optional, if missing will terminate or resume all messages with that error code across the whole BizTalk group)
    • if resume or terminate actions are selected, the script will save those messages before performing any actions (if required)
    • Date and Time Filter. New!
  • Save suspended messages to a folder location

Requirements

The account running the script must:

  • Have vbs scripting execution rights
  • Have WMI execution rights
  • Membership to BizTalk Administrator group (to save, resume and terminate messages)

Parameters

  • HostToCompare: Name of the BizTalk host to deal with suspended messages. If this parameter is empty, will interact with all the BizTalk hosts in the group.
  • ErrorCode: Error number of the suspended message to look for.
  • Action: Numeric. Values from 1 to 3:
  • Value 1: Will Terminate the message.
  • Value 2: Will Resume the message.
  • Value 3: Will just save the message, without taking any action.
  • SaveToFolder: if a folder is set, the process will try to save every message before performing an action. IF THERE IS AN ERROR WHILE SAVING THE MESSAGE, IT WILL NOT BE RESUMED/TERMINATED.
  • DeleteAllExistingFiles: IF 1, will delete all the files on SaveToFolder path before saving the messages. 
  • dDateTimeFrom: Date and Time value from. Valid format "mm/dd/yyyy hh:mm:ss" --> "04/21/2014 21:00:09" (NOTE THE 24H format and that the date is with"") 
  • dDateTimeTo: Date and Time value TO. Valid format "mm/dd/yyyy hh:mm:ss" --> "04/21/2014 21:00:09" (NOTE THE 24H format and that the date is with"") 

Examples

Example 1

Cscript SuspendedMessages.vbs BizTalkServerApplication;0xc0c01680;3;C:\SavedBizTalkMessages\new;1

​This will save all the Suspended messages in the host BizTalkServerApplication, raised by the error number 0xc0c01680. It will try to delete all the files in C:\SavedBizTalkMessages\new and will save all the messages there. 

Example 2

Cscript SuspendedMessages.vbs ;0xc0c01680;3;C:\SavedBizTalkMessages\new;1

​This will save all the Suspended messages in all the hosts in the group, raised by the error number 0xc0c01680. It will try to delete all the files in C:\SavedBizTalkMessages\new and will save all the messages there. Important note: Please, note that the parameter host is empty. That’s the reason for a ";" --> ;0xc0c01680  

Example 3

cscript .\SuspendedMessages.vbs BizTalkServerApplication;0xc0c01657;3;C:\SavedBizTalkMessages\new;1;"11/05/2014 21:41:00";"22/04/2015"

​This will save all the Suspended messages for the BizTalkServerApplication host, raised by the error number 0xc0c01657. It will try to delete all the files in C:\SavedBizTalkMessages\new and will save all the messages there.

In Addition it will get only the suspended messages between "11/05/2014 21:41:00" AND "22/04/2015

Source Code

You can download the code from here (MSDN Code gallery)

See Also

Another important place to find an extensive amount of BizTalk related articles is the TechNet Wiki itself. The best entry point is BizTalk Server Resources on the TechNet Wiki .