Activiti 5.9 introduces more BPMN 2.0 support

We released Activiti 5.9 today! My colleagues have done an outstanding job to extend the BPMN 2.0 support in the engine, basically driven by our camunda fox customers, hence we got a lot of cool new features in this release. I want to give some examples today in this post, you find more in the Activiti userguide. Feel free to drop by our cebit booth next week then we can show you the stuff in action.


Message Start Event

Example with multiple message start events

Example with multiple message start events

We now support the message start event, not only the none start event. The difference is basically the API method you have to call and the big advantage is, that this allows multiple start events in one process model, as you can see in the example. The API is pretty straightforward and allows to name the incoming message:


RuntimeService.startProcessInstanceByMessage(String messageName);

To handle the message start events we added infrastructure to Activiti 5.9 to handle messages overall. So we are currently only one step away from supporting intermediate message events, message events on event based gateways and boundary message events. We currently expect this to appear with Activiti 5.10 (scheduled for first of august).

Signal Event

Example for boundary signal event

 

We added the BPMN 2.0 Signal as you can see in the example on the left. A Signal can be either triggered by some throwing event from within the engine itself or you can trigger it from the outside of Activiti with a new API call:


RuntimeService.signalEventReceived(String signalName);

Intermediate Throwing None Event used for KPI’s

Example of intermediate none event

Example of intermediate none event

A small change in the code but a huge step for Business-IT-Alignment: We added the intermediate throwing non event, which basically does nothing. The spec says this should be used to mark an intermediate state (or milestone) in a process. This makes is a perfect place to record some KPI’s and it is more natural to read than some service tasks doing this (the workaround before Activiti 5.9). To the intermediate event you can attach some logic which is executed when a process instances passes by, this is done in the normal Activiti way by using a configurable execution listener. Here you can pass information to your BAM or BI solution for monitoring purposes. This is how the XML looks like:

<intermediateThrowEvent id="noneEvent">
  <extensionElements>
    <activiti:executionListener event="start"
        class="com.camunda.SampleKpiListener" />
  </extensionElements>
</intermediateThrowEvent>

Event Subprocesses

Event Sub Process

Event Sub Process

Event sub processes can be triggered by an event (like message events, error events, signal events, timer events, or compensation events) and are either interrupting the normal process flow or they create a new token and work in parallel (non-interrupting). This is quite powerful to handle interruptions in the normal flow or to handle e.g. inquiries for a process instance which should not disturb the normal flow. In Activiti 5.9 we added only the interrupting behavior for error events, the non-interrupting one and all other event types are still open issues and good candidates to be included in 5.10 (especially the message event).

Event based gateway

Event Based Gateway example

Event Based Gateway example

The event based gateway allows to wait for the occurrence of one of multiple events, you can already use timers and signal events here, message shall follow in Activiti 5.10.

BPMN Compensation and Transactions

Another great thing we started is to support BPMN 2.0 transactions, cancellation and compensations. This is in an early experimental phase (so please go ahead, try it out and tell us your feedback!), but some basics area already included in Activiti 5.9. Daniel has an own blog post ready especially for that topic, so stay tuned, that will be published shortly on this blog.

Limitations

We basically concentrated on the engine and the camunda fox tool chain with the fox-modeler (OEM based on Signavio) and the fox-designer (based on the Eclipse BPMN2 Modeler). Since these tools know the full range of BPMN 2.0 they are already capable to handle the new features. If you work with your own BPMN 2.0 compliant modeler, it should work as well.

In the Activiti Open Source project please note that the Activiti Designer (Eclipse) does not yet support all the new elements and the graphical visualization of processes in the Activiti Explorer (Web-GUI) cannot render some of them new elements, leaving “white holes” or some wrong renderings in parts of the process.

We have a new story about process visualization and the “where am I in the process” pics on the near roadmap, then we should be able to be full BPMN 2.0 compliant here as well and bypass limitations with the current rendering on IBM Server machines. Stay tuned for this!

Please note, that we marked some of the constructs as “experimental” in the Activiti user guide, because they are pretty fresh. We work on stabilizing them for camunda fox and Activiti 5.10.

Other new features worth mentioning

  • Error boundary Event now can handle faults on service tasks: By this you can catch and handle exceptions from Java code executed from a service task. Before 5.9 you could only catch errors from an error end event within a subprocess.
  • Suspending and Resuming Process Definitions and Instances: We now have support in the API to “pause” instances or whole process definitions. Then the process instance cannot move on and no timers or the like fire (until you reactivate the instance). I see a couple of use cases for this, starting from a temporary problem in a single process instance to an emergency stop to whole process definitions. The API looks like this:

    RuntimeService.suspendProcessInstanceById(String processInstanceId);
    RuntimeService.activateProcessInstanceById(String processInstanceId);
    RepositoryService.suspendProcessDefinitionByKey(String processDefinitionKey);
    RepositoryService.activateProcessDefinitionByKey(String processDefinitionKey);
  • Exclusive jobs and plugability of the job executor infrastructure: We can now exchange the job executor easily, which we needed for our camunda fox platform, especially for support of WebSphere, WebLogic and the like, where we use the application server capabilities instead of starting an own thread pool (as Activiti does it out-of-the-box). Exclusive jobs now add more “safety” by default but allow for more configuration for the advanced. This will be explained in more depth by a later blog post of Daniel.

猜你喜欢

转载自mojzhidao.iteye.com/blog/1498633
今日推荐