Service Task
A service task represents a work item in the process with a specific type.
When a service task is entered, a corresponding job is created. The process instance stops here and waits until the job is complete. A job worker can subscribe to the job type, process the jobs, and complete them using one of the Zeebe clients. When the job is complete, the service task is completed and the process instance continues.
#
OverviewThis assignment is about learning the interaction between Service and User Tasks. The following functionalities are used:
- Reusable Connectors
- Form creation
- FEEL expressions to map data
In this process, we request useful facts about cats at a public API. In the second step, we want to validate them in a form.
To create this awesome automated process with service and user tasks, take the following steps:
#
Request cat fact- To create a BPMN diagram, navigate to Web Modeler via the Modeler tab, and click New project.
- Name your project and select New > BPMN Diagram > + Create blank.
- Give your model a descriptive name, and then give your model a descriptive id within the General tab inside the properties panel on the right side of the screen. In this case, we've named our model "Request Cat Fact" with an id of request-cat-fact.
- Use Web Modeler to design a BPMN flow with a service task. Create a Rest Call by dragging the task icon from the palette, or click the existing start event and the displayed task icon.
- Change the task type by clicking the wrench icon. Search for "Rest Connector" and select REST Connector (No Auth).
- Add a descriptive name using the properties panel. In this case, we've named ours "Request cat fact".
- Configure the URL and Result Expression.
- Deploy the process, start an instance and check the variables within the operate application
#
Create a User Task- Create a user task by dragging the task icon from the palette and link it with the service task, or click the existing service task and the displayed task icon.
- Change the task type by clicking the wrench icon. Select User Task.
- Add a descriptive name using the properties panel. In this case, we've named ours "Check cat fact".
#
Implement a form- To add a form and check the cat fact, return to the Modeler homepage and click New > Form.
- Name your form. In this case, we've named ours "Check cat fact".
- Click and drag the Text Field element onto the palette. Give this Text field a description within the properties panel and set the key to fact. We've described ours as "Cat Fact"
You have to link the form with the corresponding UserTask by selecting it.
#
Start and view your process instance- To deploy your diagram to your cluster, click Deploy diagram > Deploy.
- To officially start a new process instance, click Start instance.
- Navigate to Operate by clicking the honeycomb icon next to the Start instance button.
- Click View process instances to see your process instance alongside the green token waiting at the user task.
#
Complete a user taskWithin this example, we've included a form to demonstrate the completion of a human task. To learn more about creating forms within your diagrams, visit our guide on building forms with Modeler.
- Go back to your Camunda Platform 8 diagram and select the honeycomb icon and then View user tasks to take a look at your user tasks inside Tasklist.
- Select the open user task on the left panel of Tasks.
- Next to Assignee, click Claim to claim the task.
- Once finished entering the appropriate information, click Complete Task.
- Check the results within the operate application