Search code examples
biztalkbiztalk-2010

BizTalk: terminate messages


If I need to build a specialized web app to be able to terminate messages processed by specific send ports, WMI is one option. Are there others? and are there pros/cons to each approach?


Solution

  • You should be able to terminate messages programmatically by referencing the Microsoft.BizTalk.Operations.dll assembly. That will allow you to use the TerminateInstance method of the BizTalkOperations Class, which allows you to reference a remote BizTalk instance (using this constructor) without enabling remote WMI administrative access.

    You may also need to reference Microsoft.BizTalk.Pipeline.dll in Visual Studio to get IntelliSense to work.

    The BizTalk SDK includes a sample app that you can review, as well, to see how to look up a message instance, which you'll need for the parameter to the TerminateInstance method: http://msdn.microsoft.com/en-us/library/gg163868

    For example:

    BizTalkOperations _operations = new BizTalkOperations()
    IEnumerable messages = _operations.GetMessages();
    foreach (BizTalkMessage msg in messages)
    …