If you want to implement an EventHandling scenario, which is more powerfull than out of the box
WF-activities this post may helpfull. You may asking yourself, what kind of advanced scenario this could be?
Here are some examples:
1. You want to handle an event within Initialization State and not in EventDriven state.
This is sometimes useful, when the workflow graph should be kept simple.
2. You want to execute multiple event handlers successively within one EventDriven-activity.
This is useful when some events has to be fired successively. Usually, you could create states, but this would
sometimes imply more complex graph. Note that designer does not allow more than one event handler in an EventDriven-activity.
3.If you want to start child workflow synchronously
4. If the first activity in an EventDriven-activity
Here is how to do it:
How to create Workflow queue and register for listening?
After the queue has been created and listening started , the Execute method of activity, which hosts this code
should return with ActivityExecutionStatus.Executing.
Note that RegisterForQueueItemAvaulable has 'this' as input param. To make this possible the activity which hosts
this code has to implement interface: IActivityEventListener<QueueEventArgs>.
Here is an example:
public partial class MyQueuingActivity : SequenceActivity, IActivityEventListener<QueueEventArgs>
How to delete Workflow queue and stop listening?
How to post a message to Workflow queue?
SomeObject obj = new SomeObject();
instance.EnqueueItem(queueName, obj, null, null);
When this code is executed, the listener-activity ca handle the message as shown in next example.
How to handle a posted message?
How to fit all together?
Hope this helps...
Jun 10 2008, 05:35 PM