Show TOC

Background documentationConditional Start Locate this document in the navigation structure

 

To model processes using the conditional start pattern, you use the same web service endpoint for the start event as well as for the intermediate message events. In BPM, a web service endpoint is represented by a reusable message trigger. The start condition and the correlation condition can be independently defined. Usually, the correlation condition is a more specific variant of the start condition. For more information about reusable message triggers, see Creating Reusable Event Triggers

In the conditional start use case, a new process is started only if there are no running processes, which match the correlation condition of the incoming message. The start event is not directly triggered by the message. First, the matching evaluation is done and if there is no running process, the process start for the active version is initiated. That means, all messages that come in at any point in time will then be received by exactly one process instance.

Example Example

A process is modeled to collect all red messages of one and the same shape.

Start condition:

message/color="red"

Correlation condition:

message/color="red" and message/shape=context/shape

In this example, context/shape is a data object in the process data context, which is initially populated from the message that had started the process (see output mapping of the start event). That means, the first message that is received by this process instance in its start event determines the shape of all other messages that will be received by that process instance in its intermediate message event.

The conditional start inhibits more than one process instance to match messages having the same color and shape, for example, only one process instance exists that matches red and rectangular shapes. There could be other process instances collecting messages that do not match this correlation condition. For example, there could be another process instance collecting messages with red and triangular shapes.

End of the example.

For real-life business examples of the conditional start pattern, see the ‘Aggregator’ enterprise pattern in SAP Community Network (http://scn.sap.com/community/process-orchestration).

Caution Caution

The start and the correlation condition must have an applicable semantics and a meaningful relation. That means, the conditions must not be disjunct and rule out each other. Do not reuse the same message trigger (web service endpoint) of a conditional start process definition in other process definitions also using the conditional start pattern.

End of the caution.
Prevention of Manual Process Start

To avoid a multi match scenario through a manual start of a conditional start process, the start process action is disabled in the process repository (http://host:port/nwa/bpm-repository). On the Processes and Tasks tab, an information message is displayed explaining that starting instances is not allowed for processes using the conditional start pattern. The message provides a link to the Web Services Navigator. This link is parameterized with the WSDL URL and the operation name so that you can directly invoke the endpoint.

In addition, the public API rejects invocations of 'startProcess(...)' for conditional start processes.

Handling of Leftover Messages

Correlation in SAP NetWeaver BPM involves two transactions, message matching and message consumption. This means, a process instance can collect an arbitrary number of incoming web services messages that match the defined correlation condition (“matching” transaction). But these messages are not necessarily consumed by the intermediate message event before the process terminates, for example, the process is manually canceled or completed via the sequence flow. Using the conditional start pattern, these messages must not be discarded but they are appropriately handled. The messages that are not yet consumed are sent to the same endpoint once again as soon as the process instance that received/matched these messages terminates. That means in detail, the messages are provided to a running process instance of the same process definition. If no instance is running one message starts a new process instance of the active process definition. The remaining messages are then provided to this particular instance. And again, the general constraints of the conditional start pattern are valid. That means, all incoming messages are received by exactly one process instance and a new process is started only if there are no running processes, which match the correlation condition of the incoming messages.