Home > BizTalk Server > Suspending a BizTalk Orchestration with Delay Shapes

Suspending a BizTalk Orchestration with Delay Shapes

Okay, here’s a question for you: what happens to an orchestration that is processing a delay shape when suspended? Well, let’s find out.

First, I built a simple schema to kick off my orchestration (nothing surprising here). Then, I built a simple orchestration:

Timer Orchestration Example

Write_Time simply prints out the time to the debugger, e.g.

System.Diagnostics.Debug.WriteLine("Time: " + System.DateTime.Now.ToLongTimeString());

The Delay shape causes a delay of 1 minute. I built my project and deployed it, and then opened up the Debugger. Next, I dropped in a message to kick off my orchestration. I got my first debug statement:

[3404] Time: 10:30:34 AM

I then suspended the orchestration at 10:30:46. I waited until 10:31:35, and then resumed the message. So, here’s the question, will it A) print the current time as soon as resumed, B) wait about 48 seconds to print, or C) wait another minute to print? Let’s see our next debug statement:

[3404] Time: 10:31:35 AM

Interesting. While suspended, it appears that the Delay shape keeps track of time. Let’s do some more tests. This time I left the orchestration running until 10:32:30 and then I suspended it again. I resumed it at 10:33:25 this time. My next message in the debugger was:

[3404] Time: 10:33:25 AM

Hmmm… will it print out every time I resume the orchestration or did this happen because it had been greater than a minute? Let’s do some more tests. I suspended the orchestration at 10:34:00. I then resumed it at 10:34:05. My next print out was:

[3404] Time: 10:34:26 AM

Interesting! No, it isn’t just printing out when I resume (it’s not just going back to the first shape after the Delay). Let’s do another (after I do some other stuff). New message kicks off an orchestration and we get our first debug:

[3404] Time: 11:31:39 AM

Then, I suspend the message at 11:31:50. I then wait a couple of minutes, until 11:34:00, and resume the orchestration. Here’s what we get for the next few printouts:

[3404] Time: 11:34:00 AM
[3404] Time: 11:35:00 AM
[3404] Time: 11:36:00 AM

So in conclusion, if the orchestration is resumed before the Delay time specified, it will continue to wait.  If more time has passed, the orchestration picks up right after the Delay shape, and continues.  In my case this means that I will now be on a new 1 minute interval, that ending right on the minute (00 seconds).

You might be asking, so what? Well, here’s why this is important. Let’s say you are using a Delay shape in your orchestration to handle retries… this means that if you suspend your orchestration for any reason, your retry time is running out! This is definitely something to account for when you’re using the Delay shape in building an orchestration.  The good news is that if your Delay shape runs out of time, the orchestration will pick up right after the Delay shape.  Good luck developing!

Categories: BizTalk Server
  1. January 31, 2011 at 3:05 pm

    Yeah, it is easy. BizTalk orch engine just checks if the resume time is >= Timer time and if so it goes ahead.
    If you look to the messages consumed by the orch waiting before(inside) the Delay shape, you’ll see this special *Timer* message.

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: