Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

You can explicitly register the activity with a timer and call the onTimedOut() method yourself or just call the startWithTimeout() method to start the activity registering the timeout.

Joins

Its very common to want to join on the completion of a number of tasks. e.g. wait until all of activities A, B and C are done, then perform activity D.

So we have 2 helper classes to provide joins.

JoinAll

This class will join on the completion of all of the child workflows. You can use a timeout to fail the activity if the join does not complete in a specified time.

Composing activities

One of the main reasons for using an object orientated language is to make composition and reuse possible; similarly BeanFlow allows you to compose activities together to make modular and reusable workflow constructs easily. So BeanFlow attempts to create a collection of reusable activities which you can then use to derive from or aggregate to make whatever activities you need.

Composition Flows

Description

JoinAll

Performs a join on all the given child activities. So the activity waits until all the child activities have completed, then it completes itself. You can add additional constraints to the activity using derivation. The default is to wait for all the child activities to complete; though you can enable fast-fail mode so that the activity fails as soon as a child activity fails

JoinQuorum

This activity is useful for implementing clustering style activities where you want a quorum of activities to complete. e.g. if you have 5 child activities you want to wait for at least 3 activities to complete succesfully before continuing

Here is an example of performing joins using collections of child workflowsFor example

Wiki Markup
{snippet:id=example|lang=java|url=http://svn.apache.org/repos/asf/incubator/servicemix/trunk/servicemix-beanflow/src/test/java/org/apache/servicemix/beanflow/JoinAllTest.java}

JoinQuorum

...

Join conditions

In workflows you often want to fork parallel steps and then join on certain events. You often have complex logic to decide on what the join condition is. e.g. in pseudo code

...

Wiki Markup
{snippet:id=join|lang=java|url=http://svn.apache.org/repos/asf/incubator/servicemix/trunk/servicemix-beanflow/src/test/java/org/apache/servicemix/beanflow/CustomJoinConditionTest.java}

Composing activities

One of the main reasons for using an object orientated language is to make composition and reuse possible; similarly BeanFlow allows you to compose activities together to make modular and reusable workflow constructs easily. So BeanFlow attempts to create a collection of reusable activities which you can then use to derive from or aggregate to make whatever activities you need.

Composition Flows

Description

JoinAll

Performs a join on all the given child activities. So the activity waits until all the child activities have completed, then it completes itself. You can add additional constraints to the activity using derivation. The default is to wait for all the child activities to complete; though you can enable fast-fail mode so that the activity fails as soon as a child activity fails

JoinQuorum

This activity is useful for implementing clustering style activities where you want a quorum of activities to complete. e.g. if you have 5 child activities you want to wait for at least 3 activities to complete succesfully before continuing

Here is an example of performing joins using collections of child workflows

Wiki Markup
{snippet:id=example|lang=java|url=http://svn.apache.org/repos/asf/incubator/servicemix/trunk/servicemix-beanflow/src/test/java/org/apache/servicemix/beanflow/JoinAllTest.java}

Building workflows

So we've been over the basics of activities. Remember they are just Java bean so you can implement them however you wish.

...