A flow control in the cloud / Flow control activities & BizTalk Workflow Services

(German version maybe coming later / deutsche Version folgt eventuell später)

This post is a continuation of my intro to BizTalk Workflow Services.

When orchestrating anything or in more simple words, when implementing an algorithm, we typically need a type of flow control. What is the order of the commands? How do we set conditions? How do we repeat something? This also is necessary when wanting to run an algorithm in the cloud. We are using BizTalk Workflow Services to describe what we want to do in the cloud. The tool we have are workflow activities.

BizTalk Workflow Services have a limited set of flow control activities:

  • CloudIfElse System.ServiceBus.Workflow.ifelse  (and CloudIfElseBranch  System.ServiceBus.Workflow.ifelseBranch)
  • CloudWhile System.ServiceBus.Workflow.while
  • CloudSequence System.ServiceBus.Workflow.sequence

This does not seem much, but together with a place to store your data it theoretically lets people implement all types of algorithms.

CloudIfElse System.ServiceBus.Workflow.ifelse  (and CloudIfElseBranch  System.ServiceBus.Workflow.ifelseBranch) work very much like their regular equivalents. However, remember that those activities are in fact a new implementation and are not identical to IfElse or IfElseBranch.

Practically you will have to remember when setting rules, that you can only use declarative rule conditions (stay tuned in some days for a post about declarative rule conditions). Trying to use a code condition in the CloudIfElseBranch System.ServiceBus.Workflow.ifelseBranch will result in this:


The CloudIfElse System.ServiceBus.Workflow.ifelse activity needs a minimum of one cloudIfElseBranches System.ServiceBus.Workflow.ifelseBranch but can have more than 2:

You can add a branch:


That branch will be always added to the right:


Notice that now cloudIfElseBranch2 displays an error (exclamation mark in red circle) because we did not set a condition on the cloudIfElseBranch2 yet. The error did not display earlier, because the last CloudIfElseBranch System.ServiceBus.Workflow.ifelseBranch in fact does not need a condition to be set. The CloudIfElseBranches' System.ServiceBus.Workflow.ifelseBranch conditions are evaluated from the left to the right.

If we do not like the position of a CloudIfElseBranch System.ServiceBus.Workflow.ifelseBranch, we can change their position with the help of the context menu easily:


We move it to the left, so we expect the cloudIfElseBranch2 (and it's red exclamation mark circle) now to be on the very left side:



The CloudWhile System.ServiceBus.Workflow.while  activity is again the cloud version of the regular While branch. And this neat activity is at the same time the reason for the CloudSequence System.ServiceBus.Workflow.sequence activity. The CloudWhile System.ServiceBus.Workflow.while  activity only allows one inner child activity to be repeated. So, what you need is a Sequence activity. However, currently you cannot use a non-cloud activity in a cloud-based workflow.

Even though as we have seen in my previous post the cloud-workflow itself is a SequenceActivity, it cannot contain a SequenceActivity but needs a CloudSequence System.ServiceBus.Workflow.sequence activity instead.

Trying to use a non-cloud activity will result in the following validation error when trying to save the XOML in the web-form:

The workflow failed validation

  • Type System.Workflow.Activities.SequenceActivity, System.Workflow.Activities, Version=, Culture=neutral, PublicKeyToken=31bf3856ad364e35 is not marked as authorized in the application configuration file.

This makes a CloudWhile System.ServiceBus.Workflow.while  with more than one activity to look like this:


In one of the next posts I will look at the other activities and a bit deeper into the conditions you can use.


A little "disclaimer": Some readers wondered why I explain very simple things here. My reasoning is that I expect completely new users to want to get started with cloud technologies without digging through the workflow foundation's fundamentals first. They will want to look at the workflow foundation's basics soon enough anyways. But it could be overwhelming for new readers and people interested in BizTalk Services to have to know too much before getting started. I aim at giving people an easier start.

Posted Aug 09 2008, 03:49 AM by Andreas Erben


... wrote re: A flow control in the cloud / Flow control activities & BizTalk Workflow Services
on 01-29-2009 23:22

Lovely. Great site.

developers.de is a .Net Community Blog powered by daenet GmbH.