Windows Workflow Foundation By Jayesh Chudasama


Using Local Services in Windows Workflows
October 3, 2006, 8:16 pm
Filed under: Blogroll, Books & writing

Notes on Local Services in Workflows

Windows Workflow Foundation workflow communication services enable a workflow to interact with an external system through messaging with methods and events.

The HandleExternalEventActivity and CallExternalMethodActivity activities on the workflow instance interact with events and methods that are declared in a custom interface and implemented in a custom local service.

The HandleExternalEventActivity activity responds to a particular event that is raised by the host application and implemented by the local service.

The CallExternalMethodActivity invokes a method on the local service.

Define a local workflow communication interface:

[ExternalDataExchange]
public interface ICommunicationService
{
void HelloHost(string message);
event EventHandler<ExternalDataEventArgs> HelloWorkflow;
}

 

Implement a communication service:

public class CommunicationService : ICommunicationService
{
public event EventHandler<ExternalDataEventArgs> HelloWorkflow;

public void HelloHost(string message)
{ Console.WriteLine(“This is the message: {0}”, message);

// Raise the HelloWorkflow event.
HelloWorkflow(null, new ExternalDataEventArgs(WorkflowEnvironment.WorkflowInstanceId));
}

}

Add the ExternalDataExchangeService to the workflow runtime engine and then add your custom communication service to the ExternalDataExchangeService:

ExternalDataExchangeService externalService = new ExternalDataExchangeService();
workflowRuntime.AddService(externalService);
externalService.AddService(new CommunicationService());

Source [ Concepts on Windows SDK ]

  1. Using Local Services in Workflows
  2. Using the HandleExternalEventActivity Activity
  3. Using the CallExternalMethodActivity Activity
  4. Communicating with Other Workflows
  5. Workflow and Application Communication

Other Articles

The HandleExternalEvent Activity in Windows Workflow By Scott Allen
WS-Transfer Service for Workflow

Advertisements

Leave a Comment so far
Leave a comment



Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s



%d bloggers like this: