Logo
programming4us
programming4us
programming4us
programming4us
Home
programming4us
XP
programming4us
Windows Vista
programming4us
Windows 7
programming4us
Windows Azure
programming4us
Windows Server
programming4us
Windows Phone
 
Windows Server

BizTalk 2010 Recipes : Orchestrations - Using the Loop Shape

- How To Install Windows Server 2012 On VirtualBox
- How To Bypass Torrent Connection Blocking By Your ISP
- How To Install Actual Facebook App On Kindle Fire
4/11/2011 6:50:38 PM

1. Problem

You need to repeat a series of steps in an orchestration until a certain condition is met.

2. Solution

You can use the Loop shape in a BizTalk orchestration, in a manner similar to using a loop in any programming language, such as this looping logic:

int a = 0;
while(a < 3)
{
System.Console.WriteLine(a);
a = a + 1;
}

As an example, the following steps show how to implement a loop that terminates after a counter variable has been incremented to a certain value. The orchestration will loop three times, logging its progress to the Windows Event Viewer.

NOTE

The example demonstrates a complete orchestration that could be called from another orchestration using the Call or Start Orchestration shape. To make this a stand-alone orchestration, simply add a Receive shape as the first step and bind it to a port.

  1. In an empty orchestration, create a new variable called intCount. Make it of type Int32. This will represent the loop counter.

  2. Drop an Expression shape on the design surface. Rename this shape to Set_Count. Then double-click the shape, and type in the following code:

    //initialize counter
    intCount = 0;

  3. Drop a Loop shape below the Set_Count shape. Double-click the Loop shape, and enter the following code (note there is no semicolon):

    //loop while count is less than 3

    intCount < 3

  4. Drop another Expression shape inside the Loop shape, and rename it Increase_Count. Enter the following code:

    //increase counter
    intCount = intCount + 1;
    //log to the event viewer
    System.Diagnostics.EventLog.WriteEntry("Count",
    System.Convert.ToString(intCount));

The orchestration is shown in Figure 1.

Figure 1. Loop shape with counter

3. How It Works

The Loop shape has many applications, from looping through XML documents to supplementing the Listen shape, exception handling routines, and so on. Orchestrations can mimic the behavior of long-running Windows services with the proper placement of a Loop shape. For example, if you need to poll for data on a timed interval, you could set up an orchestration to do this. An initial Receive shape would instantiate the orchestration and immediately enter a loop. Once in the loop, it would never exit, looping every [x] number of minutes to reexecute a series of steps. The orchestration would be long-running and would never end until terminated manually. An example of this type of orchestration is shown in Figure 2.

Figure 2. Long-running polling orchestration
Other -----------------
- BizTalk 2010 Recipes : Orchestrations - Using the Parallel Action Shape
- BizTalk 2010 Recipes : Orchestrations - Receiving Untyped Messages
- Windows Server 2008 R2 : File System Management and Fault Tolerance - Using the Volume Shadow Copy Service
- Windows Server 2008 R2 : File System Management and Fault Tolerance - Backing Up DFS
- Windows Server 2008 R2 : File System Management and Fault Tolerance - Managing and Troubleshooting DFS
- SharePoint 2010 PerformancePoint Services : SharePoint 2010 Filters
- SharePoint 2010 PerformancePoint Services : PPS Filters
- Feature Comparison Between SharePoint Foundation 2010 and SharePoint Server 2010 for Farm Administrators (part 3)
- Feature Comparison Between SharePoint Foundation 2010 and SharePoint Server 2010 for Farm Administrators (part 2)
- Feature Comparison Between SharePoint Foundation 2010 and SharePoint Server 2010 for Farm Administrators (part 1)
 
 
Top 10
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Finding containers and lists in Visio (part 2) - Wireframes,Legends
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Finding containers and lists in Visio (part 1) - Swimlanes
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Formatting and sizing lists
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Adding shapes to lists
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Sizing containers
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 3) - The Other Properties of a Control
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 2) - The Data Properties of a Control
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 1) - The Format Properties of a Control
- Microsoft Access 2010 : Form Properties and Why Should You Use Them - Working with the Properties Window
- Microsoft Visio 2013 : Using the Organization Chart Wizard with new data
- First look: Apple Watch

- 3 Tips for Maintaining Your Cell Phone Battery (part 1)

- 3 Tips for Maintaining Your Cell Phone Battery (part 2)
programming4us programming4us
Popular tags
Microsoft Access Microsoft Excel Microsoft OneNote Microsoft PowerPoint Microsoft Project Microsoft Visio Microsoft Word Active Directory Biztalk Exchange Server Microsoft LynC Server Microsoft Dynamic Sharepoint Sql Server Windows Server 2008 Windows Server 2012 Windows 7 Windows 8 windows Phone 7 windows Phone 8
programming4us programming4us
 
programming4us
Natural Miscarriage
programming4us
Windows Vista
programming4us
Windows 7
programming4us
Windows Azure
programming4us
Windows Server
programming4us
Game Trailer