I've just uploaded a set of sample Windows Workflow Foundation activities for Microsoft Message Queue in the Winterdom.Workflow.Activities.Msmq assembly.
The MsmqSendActivity allows you to send a .NET object as an MSMQ message by just binding the activity to one of your workflow's properties and selecting the appropriate formatter (XmlMessageFormatter or BinaryFormatter). If the queue is transactional, you can put the activity inside a TransactionalScope activity.
The MsmqReceiveActivity allows you to receive an MSMQ message into a typed .NET object; the activity will do the deserialization based on the selected formatter. The activity can also be used inside an EventDrivenActivity so you can use it inside a Listen shape or in a StateMachine workflow to trigger state changes.
The samples include the following features:
- Bindable properties, through both direct and attached dependency properties.
- Design-Time support: each activity has a customized appearance. The MsmqReceiveActivity also shows the use of a custom activity designer to synthetize a property at design-time that supports binding.
- Validation support: Both activities contain sample validators to ensure the required properties are configured correctly.
Here's a sample of how they could be used in XOML:
xmlns:ns0="clr-namespace:Winterdom.Workflow.Activities.Msmq;Assembly=Winterdom.Workflow.Activities.Msmq, Version=184.108.40.206, Culture=neutral, PublicKeyToken=null"
<ActivityBind Name="SampleWorkflow2" Path="_customerToSend" />
<ActivityBind Name="SampleWorkflow2" Path="_customerReceived" />
If you plan to use the MsmqReceiveActivity, you'll need to configure the MsmqListenerService service into the WorkflowRuntime, like this:
WorkflowRuntime workflowRuntime = new WorkflowRuntime("ConsoleApplication");
Update: The sample activities can be downloaded from here.
I hope to improve them and add new functionality (if I can) to them, so if you have any comments/bugs/features, do let me know! One feature I would definitely like to implement is correlation support, but as of now I'm not entirely sure what the best approach for that might be.