Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3

...

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.

Note
titleAvailability

Note that this component is not yet available in the current smx version.

Tip
titleOSWorkflow HowTo

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.

Installation

Installing the servicemix-osworkflow component can be done in several ways:

  • drop the installer zip in an hotdeploy directory monitored by ServiceMix
  • using ant tasks

Note that when using ant tasks, the component is not started, you will have to start it manually using ant tasks or a console.

Creation

Maven Archetype

You can use Maven servicemix-osworkflow-service-unit archetype to create a service unit.:

Code Block
mvn archetype:create \
    -DarchetypeGroupId=org.apache.servicemix.tooling \
    -DarchetypeArtifactId=servicemix-osworkflow-service-unit \
    -DarchetypeVersion=2010.01 \
    -DgroupId=comyour.mycompanygroup.myproductid \
    -DartifactId=mycomponentyour.artifact.id \
    -Dversion=your-version

This will give you a simple workflow example to start with.

Code Block
<dir>
|--- src
     |--- main
          |--- java
          |    |--- ExampleFunction.java
          |    |--- ExampleCondition.java
          |--- resources
               |--- exampleflow.xml
               |--- osworkflow.xml
               |--- workflows.xml
               |--- xbean.xml

XBean deployment

You can deploy Service Units containing a file named xbean.xml for activating endpoints.
Note that you have to define the http namespace with

...


<beans xmlns:osworkflow="http://servicemix.apache.org/osworkflow/1.0">
    ...
</beans>

Endpoint Configuration

Any numbers of endpoints can be specified in the xbean.xml file.

Endpoints

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.

Code Block
langxml
titleOSWorkflow endpointEndpoint
<osworkflow:endpoint service="test:workflow"
                       endpoint="workflowEndpoint"
                       action="1"
                       caller="callerName"
                       workflowName="testflow" />
Info
titleOSWorkflow endpoint attributesEndpoint Attributes
borderStylesolidbgColor='lighblue'

Name

Type

Description

Required

service

QName

the service name of the exposed jbi endpoint

yes

endpoint

String

the endpoint name of the exposed jbi endpoint

yes

action

String

the initial action called in workflow (must be an a int value)

yes

caller

String

if set, this will be set as the caller user name of the workflow

no

workflowName

String

the name of the workflow to start. This name must be specified in workflows.xml

yes

...

Info
titleTransientVars
borderStylesolidbgColor='lighblue'

Key-Constant

Value-Type

Value-Description

OSWorkflow.KEY_EXCHANGE

MessageExchange

the message exchange which was received before this workflow was started

OSWorkflow.KEY_IN_MESSAGE

NormalizedMessage

the "in" message which was received before this workflow was started

OSWorkflow.KEY_ENDPOINT

OSWorkflowEndpoint

the endpoint managing this workflow (provides useful helper methods)

OSWorkflow.KEY_CALLER

String

The caller user name defined in the endpoints configuration (caller in xbean)

OSWorkflow.KEY_ASYNC_PROCESSING

boolean Boolean

if true, the workflow is running in a separate thread

...

Warning
titleAttention

You are completely 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.