Resume Orchestration Instances in Breakpoint via code

Posted: February 10, 2010  |  Categories: BizTalk Uncategorized
Tags:

Triggered by a question on the MSDN Forums I did some digging in Reflector to find out the way to programmatically resume orchestration instances that have been stopped in a breakpoint via the Orchestration Debugger. I quickly realized that resuming the orchestration instances using the Operations dll does not work, so here is what I have come up with.

You need to add a reference to Microsoft.BizTalk.Operations.dll, Microsoft.XLANGs.BizTalk.Client.dll and Microsoft.XLANGs.RuntimeTypes.dll. These are found on the BizTalk installation folder.

Add the following using statements to your class usings list:

using Microsoft.BizTalk.Operations;

using BizTalkXLANGsClient=Microsoft.BizTalk.XLANGs.Client;

using Microsoft.XLANGs.RuntimeTypes;

Then in your method or wherever in your code you need to resume all the orchestrations run the following code. Note that it will resume all the orchestration instances that are in a breakpoint, you need to filter them out by inspecting the Instance objects if you only want to resume specific ones:

var bo = new BizTalkOperations();

IDebugProxy proxy;

try

{

    //Loop through instances

    foreach (Instance op in bo.GetServiceInstances())

    {

        //Check if this is an orchestration instance in a suspended state

        if ((!(op is OrchestrationInstance)) || !(op as OrchestrationInstance).InBreakpoint) continue;

        textBox1.Text = op.ID.ToString();

 

        //Get the debug proxy to resume the orchestration instance

        proxy = null;

        proxy = BizTalkXLANGsClient.Activator.GetDebugProxyInstance(

            "BizTalk Group", op.HostName, op.ServiceTypeID, op.ID);

        proxy.Resume();

    }

}

catch (Exception ex)

{

    //Handle the exception

}

I’ve tested it on my development environment and it runs fine. It might take a few seconds for HAT/Admin Console to show that the status changed from ‘In Breakpoint (Active)’ to ‘Active’.

Of course do not run this in a production environment before testing it thoroughly in a test environment, remember to add code to the exception handler, and update the first parameter of GetDebugProxyInstance if your BizTalk group is not named ‘BizTalk Group’.

Regards,

Thiago Almeida

1 thought on “Resume Orchestration Instances in Breakpoint via code”

Comments are closed.

BizTalk360
BizTalk Server

Over 500+ customers across
30+ countries depend on BizTalk360

Learn More
Serverless360
Azure

Manage and monitor serverless
components effortlessly

Learn More
Atomicscope
Business Users

Monitor your Business Activity in iPaaS
or Hybrid integration solutions

Learn More

Back to Top