Workflow Instances in SonataFlow Dev UI extension

In SonataFlow Dev UI extension, the Workflow Instances page is used to monitor and manage the available instances. The Workflow Instances page displays a list of available instances and add filters to the list.

kogito swf tools workflow instances empty
Figure 1. Workflow Instances page with no instances

To create a workflow instance, you can use the Workflow Definitions page. For more information, see Workflow Definitions in SonataFlow Dev UI extension.

When you create a workflow instance, the instance appears in the workflow instances table on the page, containing the following details:

  • Id: Displays the name and business key of an instance. Also, when you hover on the name of the workflow instance, a unique ID is displayed for the instance. You can click on the ID to navigate to the Workflow Details page.

  • Status: Displays the current state of the instance. This column can contain Active, Completed, Aborted, Error, and Suspended as values.

  • Created: Displays the time reference indicating when the instance is created.

  • Last Update: Displays the time reference indicating when the instance is last updated.

kogito swf tools workflow instance completed
Figure 2. Workflow Instances page with an instance

You can also sort the columns of the workflow instances table.

On the Workflow Instances page, you can filter the list of workflow instances based on the states and business keys. By default, Active, Completed, Aborted, Error, and Suspended are applied on the list. You can use the Status drop-down to see the available states. To filter the workflow instances based on the states, select or unselect the states in the Status drop-down and click Apply filter button.

To filter the workflow instances based on business keys, enter a business key in the Filter by business key field and click Apply filter button.

kogito swf tools workflow instances filters
Figure 3. Example filters applied on the workflow instances

To fetch the newly added workflow instances, click on the refresh icon next to the Apply Filter button. Also, to clear the applied filters and reset to the default state, click Reset to default button.

Opening the Workflow instance details

In the workflow instances table, the Id column contains a clickable link, which enables you to navigate to the Workflow Details page. The Workflow Details page contains various panels, providing detailed information about a workflow instance.

kogito swf tools workflow details page
Figure 4. Example Workflow Details page

The Workflow Details page consists of the following panels:

  • Serverless Workflow Diagram panel

  • Timeline panel

  • Details panel

  • Variables panel

    Serverless Workflow Diagram panel

    The Serverless Workflow Diagram panel enables you to explore the workflow diagram and execution path of the workflow instance. The workflow diagram and execution path are displayed by consuming the source which is exposed through the kie-addons-quarkus-source-files.

    To add the source files add-on configuration, add the following dependency to pom.xml file of your project:

    source-files add-on dependency in pom.xml file
    <dependency>
      <groupId>org.kie</groupId>
      <artifactId>kie-addons-quarkus-source-files</artifactId>
    </dependency>

    There is a slider available in the diagram panel, which when dragged to the right displays the source code in read-only mode.

    kogito swf tools workflow stunner diagram panel
    Figure 5. Stunner based Diagram panel
    Timeline panel

    The Timeline panel displays the list of nodes that are related to a workflow instance. Each node in the Timeline panel consists of an icon, indicating the state of the node, such as Active, Completed, or Error.

    kogito swf tools workflow timeline panel
    Figure 6. Timeline panel
    Details panel

    The Details panel displays the basic information related to a workflow instance, including:

    • Name: Name of the workflow instance.

    • Business key: Business key related to the workflow instance.

    • State: Current state of the workflow instance.

    • Id: Unique ID of the workflow instance.

    • Start: Time reference indicating when the workflow instance is started.

    • Last Updated: Time reference indicating when the workflow instance is last updated.

    • End: Time reference indicating when the workflow instance is completed.

    kogito swf tools workflow details panel
    Figure 7. Details panel
    Variables panel

    The Variables panel displays the data of a workflow in the form of JSON.

    kogito swf tools workflow variables panel
    Figure 8. Variables panel

Sending Cloud Events to active Workflow Instances

The Workflow Instances page also allows you to send HTTP Cloud Events to the active workflow instances that are waiting for an event to advance.

To do so you just have to click on the Trigger Cloud Event button that will lead you to the Trigger Cloud Event page.

Once there, you will have to fill out the form with the Cloud Event information:

  • Endpoint: Defines the Path and the HTTP method where the cloud event should be triggered.

  • Event Type: Sets the Cloud Event type header.

  • Event Source: Sets the Cloud Event Source header. Defaults to /local/quarkus-devUi.

  • Instance Id: Sets the id of the workflow instance that must receive the event, it will be added in the kogitoprocrefid event header.

  • Event Data: Data that will be in the event in JSON format.

kogito swf tools workflow instances cloud event
Figure 9. Sending a Cloud Event to an active workflow instance.

Additionally, you can use the Send Cloud Event action present available on the instance actions kebab. By using it, you will be led to the Trigger Cloud Event page, but in this case the Instance Id field will be already filled with the selected workflow id.

kogito swf tools workflow instances kebab
Figure 10. Send Cloud Event button in the actions kebab.

To enable the actions kebab, make sure your project is configured to have the kie-addons-quarkus-process-management dependency on its pom.xml file, like:

<dependency>
  <groupId>org.kie</groupId>
  <artifactId>kie-addons-quarkus-process-management</artifactId>
</dependency>

Click the Trigger button to trigger the cloud event. If the event is successfully triggered, a success alert appears at the top of the screen, which contains the Go to workflow list link to navigate to the Workflow Instances page.

kogito swf tools workflow instances cloud event success
Figure 11. Example of cloud event successfully sent notification.

If there is an issue while sending the event, then a failure alert appears at the top of the screen, containing View Details and Go to workflow list options. The View Details enables you to view the error message.

kogito swf tools workflow instances cloud event failure
Figure 12. Example cloud event unsuccessfully sent notification.

Found an issue?

If you find an issue or any misleading information, please feel free to report it here. We really appreciate it!