Sep 22, 2008

Using HandleExternalEventActivity

Implement the class that will be used as the vent arguements,this argument must derived from ExternalDataEventArgs.

Define the evetn in a local service interface. A local service interface is one that has been decorated with the ExternalDataExchangeAttribute and implemented by a local service class.

Implement the event a local service class.

Add an instance of the ListenActivity to a workflow. This create an initial set of two EventDrivenActivity instance as children of the ListenActivity. Each EventDrivenActivity represent a seperate exectuion branch that must be started by an activity implementing IEventActivity.

Add the HandleExternalEventActivity to one of the EventDrivenActivity branches. The HandleExternalEventActivity has a number of properties that must be set a design time. You first select the interface that identifies the local service. After selecting an interface, you must select the event that you wish to handle from a list of availabe events.

Complete the second EventDrivenActivity instance by adding an activity that implements IEventActivity. If you don't have another external event that you wish to handle, you can use a DelayActivity.

You must also decide how you want to handle the event arguments when the event is received. Presumably, the event arguments carry data that the workflow requires in order to continue processing. One option is to define a parameter binding that sets a workflow property to the value of the event arguments when they are received. You can then use the event arguments elsewhere in your workflow by referencing the workflow property. Another option is to add a code handler to the Invoked event of the HandleExternalEventActivity. This enables you to work with the event arguments directly in this handler as they are received.


No comments:

Post a Comment