The ServiceMix OSWorkflow component provides workflow functionality to the ESB. You can specify one or more workflows and it's processing will start when a valid message is received.
|
If you have no experience with the OSWorkflow itself, then it would be a good idea to have a look at the website http://www.opensymphony.com/osworkflow/ and reading the documentation and tutorials there. |
You can use Maven servicemix-osworkflow-service-unit archetype to create a service unit:
mvn archetype:create \
-DarchetypeGroupId=org.apache.servicemix.tooling \
-DarchetypeArtifactId=servicemix-osworkflow-service-unit \
-DarchetypeVersion=2010.01 \
-DgroupId=your.group.id \
-DartifactId=your.artifact.id \
-Dversion=your-version
|
This will give you a simple workflow example to start with.
<dir>
|--- src
|--- main
|--- java
| |--- ExampleFunction.java
| |--- ExampleCondition.java
|--- resources
|--- exampleflow.xml
|--- osworkflow.xml
|--- workflows.xml
|--- xbean.xml
|
The endpoint will receive messages from the NMR and will start then the processing of the workflow. You
can send both, InOnly and InOut messages to this endpoint. Sending an InOnly message will start the workflow in
a separate thread, while sending an InOut will result in sychronous processing of the workflow.
<osworkflow:endpoint service="test:workflow"
endpoint="workflowEndpoint"
action="1"
caller="callerName"
workflowName="testflow" />
|
|
For all xbean file endpoint configuration take a look at Xml schemas
To help you working with this component, there are several variables predefined in the transientVars.
|
|
You are completly responsible for doing the message handling. If you received a InOnly exchange for example, you have to set it's state to DONE yourself. Also when working with InOut exchanges you have to send the answer yourself in the workflow. For the error handling it's the same. |