Starting a process via Kafka

To trigger a process using a Kafka Send Action, follow these steps:

  1. Access Your Project

    • Open FlowX Designer.
    • Navigate to Projects and select your project.
    • Choose an existing process definition or create a new one.
  2. Configure the Send Message Task

    • Add a Send Message Task to your workflow.
    • Attach a Kafka Send Action to the Send Message Task node.
  3. Define the Kafka Topic

    • Specify the topic linked to the KAFKA_TOPIC_PROCESS_START_BY_NAME environment variable (details here). This variable is shared between the application-manager and runtime-manager deployments.

To check further what was sent on Kafka, you can use a tool like AKHQ to check the response sent on the topic defined at KAFKA_TOPIC_PROCESS_START_BY_NAME_OUT - details here.

To verify the topic in FlowX Designer, navigate to: Platform status → FlowX Components → application-manager-mngt -> kafkaTopicHealthCheckIndicator → details → configuration → topic → process → start-by-name:

  1. Add the Message Body
    • Include the message body with the necessary details (if applicable):
{"test": "something"}
  1. Configure headers in Advanced Settings
  • Expand Advanced Configuration in the Send Message Task settings.
  • By default, a custom header is set to:
{"processInstanceId": "${processInstanceId}"}

This header is not required and can be ignored.

  • Add the following headers:
    • Fx-ProcessName → The name of the process you want to start via Kafka.
    • Fx-AppId → The ID of the project (application) where the process resides.
    • jwt → Your JWT token for authentication.

The headers section should resemble this structure:

{
  "Fx-ProcessName": "test_kafka",
  "Fx-AppId": "afcc6452-f50e-4d95-ae3b-6b35caed68bd",
  "jwt": "your_jwt"
}

Without an active policy, the process may not start even if the Kafka message is correctly configured.

Timer start event

To initiate a process using a Start Timer Event:

  1. Open FLOWX Designer, head to the Processes tab, then select Definitions.
  2. Opt for an existing process definition or create a new one.
  3. Incorporate a Start Timer Event and configure it as required, specifying either a specific date or a cycle.

Starting a process through registered timers necessitates sending a process start message to Kafka, requiring a service account and authentication. For detailed guidance, refer to:

Service Accounts

For deeper insights into the Start Timer Event, refer to the section below:

Start Timer Event

Message catch start event

To initiate a process using a Message Catch Start Event, two processes are required. One utilizes a throw message event, while the other employs a start catch message event to initiate the process.

Configuring the parent process

  1. Access FlowX Designer, proceed to the Processes tab, then select Definitions.
  2. Opt for an existing process definition or create a new one.
  3. Configure your process and integrate a Message Throw Intermediate event.
  4. Add a task or a user task where process data bound to a correlation key is included (e.g., ‘key1’).

  1. Configure the node, considering message correlation.

Message correlation is vital and achieved through message subscriptions, involving the message name (must be identical for both throw and catch events) and the correlation key (also known as the correlation value).

Configuring the process with catch event

Now, we will configure the process that will be started with the start catch message event:

  1. Follow the initial three steps from the previous section.
  2. Integrate a Start Message Catch event node.
  3. Configure the node:
    • Include the same message name for correlation as added in the throw message event (e.g., ‘start_correlation’).
    • In the Receive data tab, add the Process Key, which is the correlation key added in the throw event (e.g., ‘key1’).

Once both processes are configured, commence the parent process. At runtime, you’ll notice the initiation of the second process:

Task management using Hooks

Initiating processes through hooks involves the creation of a hook alongside two essential processes: one acts as the parent process, while the other is triggered by the hook.

Creating a hook

Hooks play a crucial role in abstracting stateful logic from a component, facilitating independent testing and reusability.

Users granted task management permissions can utilize hooks to initiate specific process instances, such as triggering notifications upon event occurrences.

Follow the next steps to create a hook:

  1. Create a Hook: Access FlowX Designer, navigate to the Plugins tab, and choose Task Manager → Hooks.
  2. Configure the Hook:
    • Name: Name of the hook
    • Parent process: Process definition name of the parent process
    • Type: Process hook
    • Trigger: Process Created
    • Triggered Process: Process definition name of the process that we want to trigger
    • Activation status

For further details about hooks, refer to the section below:

Hooks

Setting up the parent process

  1. In FlowX Designer, navigate to the Processes tab and select Definitions.
  2. Choose an existing process definition or create a new one.
  3. Customize your BPMN process to align with your requirements.
  4. Ensure the process is integrated with task management. To do this, within your Process Definition, access Settings → General and activate “Use process in task management”.

Establishing appropriate roles and permissions within the parent process (or the service account used) is mandatory to enable it to trigger another process.

Now proceed to configure the process that the hook will trigger.

Configuring the triggered process

To configure the process triggered by the hook, follow the initial three steps above. Ensure that the necessary roles and permissions are set within the process.

Upon running the parent process, instances will be created for both the parent and the child processes.