Workflow in the Cloud

יום שלישי, יולי 26, 2011

One of the major missing parts in windows azure was the support for workflow. You could install a workflow on a web role but when multiple instances of the web role try to persist and load the same workflow instance an exception is thrown. Workflow was designed to run by a single host that persist its state to a single database. This concept does not fit to the cloud that uses multiple computing instances by design. Azure AppFabric provides the solution. A whole new host was developed especially for the cloud. We as developers do not have to...
no comments

Bookmark with Timeout

יום שלישי, אפריל 12, 2011

Bookmark is a simple mechanism for asynchronous triggering provided by Workflow 4.0. In a NativeActivity we create a bookmark and wait.  In the host (WorkflowApplication) we resume the bookmark and continue execution. I think that the mechanism is too simple. For example: What about timeouts? Well it is impossible to set a timeout and limit the time the workflow will wait on the bookmark. I found a solution by creation a custom activity which wraps the activity that owns the bookmark and use a Pick activity to implement the timeout. Here is the code: ...
tags: ,
one comment

How to add a custom icon to WF 4 custom activities (toolbox and designer)

יום שני, פברואר 14, 2011

Adding a custom toolbox icon to your custom activity is a simple task yet there are few rules to follow. To add the custom Icon we use ToolboxBitmap Attribute. like so: public sealed class MyActivity : NativeActivity The icon "myIcon.bmp" must be a bitmap file The icon must be 16X16 pixels The icon must be compiled as embedded resource in the current assembly To display...
tags: , ,
3 comments

Custom Workflow Activity – Property or Argument

יום ראשון, נובמבר 7, 2010

In WF 3.5 custom activity input was written to properties. The developer who would use these activities would set values to properties directly in the designer or using binding. In WF 4.0 it is possible continue to use regular CLR properties or to use Input Arguments exposed as properties. The question is when to do what. Well… 1.       When the input value is needed before the activity is executed, for example in the CacheMetadata method - CLR properties are...
tags: , ,
one comment

CacheMetadata in Flowchart activities

יום שלישי, ספטמבר 7, 2010

I was building some custom activities which use dynamic arguments. Dynamic arguments are created on runtime based on the values of some of the activities properties. The code that creates the arguments is called by visual studio designer and it is written in the activity's CacheMetadata(NativeActivityMetadata metadata) method as well as in the activity designer code-behind. When I used my custom activities inside a sequence workflow everything worked great but when I used them in a flowchart workflow dynamic arguments where not created. I started to debug this and found out that in a flowchart workflow...
tags: ,
no comments

How to bind WF 4.0 arguments to ExpressionTextbox in Code

יום שני, יוני 14, 2010

Almost every activity has arguments. The workflow designer presents only the root activity's arguments (these are the "Workflow Arguments") The activity's arguments has to be binded to ExpressionTextbox placed on the activity canvas (i.e. The Activity designer). When your activity is static and is completely defined in xaml there is no problem to define the binding in the xaml definition of the activity designer (there are tons of examples).The question is what happens when arguments and ExpressionTextBoxes are built in code? How can we bind dynamically created arguments with dynamically created...
tags:
4 comments

Returning a Custom Type OutArgument From WF 4.0

יום רביעי, יוני 9, 2010

In Workflow 4.0 it is easy to return values. All you have to do is create a set of out arguments and provide the arguments with values. The values will be available in a dictionary in the WorkflowApplicationCompletedEventArgs parameter of the Completed handler.   There is one simple step that is often being forgotten, that is to create an instance of the value to return. If the OutArgument is of type string (or other primitive) all you have to do is set the string value to the argument. But if the argument is of a custom type...
tags:
no comments