Skip to main content
Version: 10.2.8

Start Business Process by internal event

If you have several Business Processes (BP) where one BP produces data for another, you can apply the event-based communication mechanism and easily configure data transfer between them. To do it, you can start a sub-process from another BP based on a specific event or initiate transaction processing from another transaction within a different BP.

No-code sub-process execution steps

The event-based communication enables sending data from one BP to another in synchronous and asynchronous ways. To configure at which stage of the main BP to send an event and which BP should receive this event, add a special Sub-process Execution step (asynchronous or synchronous) when designing your BP.

Both steps are of the ETL type and have one dynamic field to configure.

You can insert the step in any place of the main BP. There are two Sub-process Execution steps to choose from:

  • Asynchronous Sub-process Execution sends data to the sub-process and proceeds to the following step immediately.

  • Synchronous Sub-process Execution waits until the sub-process finishes the step that has the export plugin with the send-to-external-connector attribute.

    Output data from the sub-process is written over the input data from the main BP. Mind that system fields with the _sys prefix are filtered out during merging. Thus, if the sub-process adds some _sys fields to its output data, they are not transferred to the main BP.

info

For both synchronous and asynchronous execution types, the output data of the step before the Sub-process Execution step is the input data for the sub-process.

Configuration

To start a BP by an event, configure the signalID parameter for your sub-process. The parameter is used to find a sub-process BP instance or a BP definition if there are no active instances in the same way as for the REST connector. Perform the following steps:

  1. Go to the sub-process's Data tab and select the Streaming Records from External Sources checkbox.

  2. In the field next to the checkbox, enter the signalID parameter you want to use for this sub-process.

  3. For the synchronous sub-process execution, add the send-to-external-connector="true" attribute to the export plugin of the step that returns data to the main BP. Usually, it is the last step of your BP, for example:

    <?xml version="1.0" encoding="UTF-8"?>
    <config charset="UTF-8">
    <!--Your business logic ...-->
    <export include-original-data="true" send-to-external-connector="true">
    </export>
    </config>
    warning

    If you do not add the send-to-external-connector attribute to the export plugin of any step of the sub-process, a record in the main BP freezes at the sub-process step even when the sub-process finishes. As a result, the main BP fails to finish.

  4. On the Workflow tab of the main BP, add one of the two Sub-process Execution steps:

    • Asynchronous Sub-process Execution

    • Synchronous Sub-process Execution

  5. In the step settings, on the Design tab, enter the signalID parameter used for the sub-process in the signal_id field.

    The configuration is saved in a Bot Task content XML:

    <?xml version="1.0" encoding="UTF-8"?>
    <config type="bp-call-event">
    <signalId>{{signal_2}}</signalId>
    <synchronous>true</synchronous>
    </config>

    If no BP exists with signalID specified in the step settings, a new BP instance for that signalID is started. The BP definition is based on the most recent run with the same signalID.

  6. Run the sub-process (optional) and the main BP. If you do not start the sub-process, it is started automatically when the record reaches the Sub-process Execution step in the main BP.

Execution

The main BP acts as a client that utilizes the external connector mechanism to trigger the processing of some records for specified signalID. The common input connector record queue is used to send an event for processing, and a separate queue is used to transfer results.

Mind the following execution logic:

  • The main BP cannot send events to itself. You cannot specify the signalID parameter that points to the BP for which you configure the sub-process execution step. However, you can send events to the main BP from other BPs.
  • If the multi-column export plugin is used in the sub-process result step, the first result record goes to the main BP. Other records are ignored.
  • If you stop or pause the main BP, the sub-process is unaffected.
  • If the sub-process fails, the Sub-process Execution step in the main BP fails as well.
  • The Sub-process Execution step cannot be stateless.