Camunda Platform 8 SaaS mode: job worker/connector, how to?

I’m in charge of evaluating Camunda Platform 8 for a client. For simplicity, I chose Camunda Platform 8 in SaaS mode. I need to (1) write some script in a Script Task to create “fake” process instance variables, (2) simply call a RESTful Web service and (3) get the control within a Task with some Java code (Job worker?, connector?). For instance, for (1) there is no field to write the script in? For (3), I suppose that I’ve to point to my Java code, but how to? The docs is nice, but often my search on the Web leads to ver. 7.
While my BPMN processes easily deploy and run in the Operate console. It’s very contemplative… Do I have to move to the self-managed config.? The proposed case studies in the docs rarely show screenshots…
Thanks for any advice

Hey @Bab64

First of all: https://docs.camunda.io/ is for Camunda 8, instead: https://docs.camunda.org/ leads to the documentation for Camunda 7.

  1. Script Tasks are implemented the same way like Service Tasks in Camunda 8. So in your bpmn diagram you have to define a job-type. Then you can choose any language client of your choice and write your script. At the moment Camunda supports officially Go and Java but there are more from the community like NodeJs, Python, Ruby etc.
  2. For making a simple REST call I would suggest to try out the Camunda 8 REST Connector in SaaS. In the Webmodeler you can select the REST connector as task type and set the details in the property panel.
  3. Your java code is pointed through the job-type attribute to the Model. See above. There is an example in the docs how to write a job worker. If you use Spring, I would recommend you to have a look into the Spring-Solution-Template. You can use the annotation @ZeebeWorker(type = "my-service", autoComplete = true), to create an adapter to the service task in Zeebe.

I hope this helps
Cheers
Nele

1 Like

Hi Hele. Thanks about your help.
I’ve still difficulties. Below a screenshot of the fields dedicated to a task script. I imagine that the job type is “My_job_type” (is this an enumerated type with predefined values, ie, ‘script’, etc.). Where and how can I fill in the language client and the script itself? I understand the “Template” option to choose between common service consumptions (for BPMN Service tasks obviously), but don’t see the link with BPMN script tasks ???

Solved (I suppose). I must use headers. I just hope that I may force the creation of ‘order’ as process instance variables with such a code? Reminder: my purpose is just an evaluation of Camunda v.8, so I need fake data for simplification

Hey @Bab64 ,

As said above, Script and Services tasks are implemented the same way in camunda 8. There is no input field for script, instead, you have to build a job worker, and within the job worker you can run your script.

I hope this helps
Kind regards
Nele

Sorry, but I no longer understand anything. The v8 doc. gives this XML with script code (ie, “a + b” in JS) inside XML and thus inside field (see screenshot) in BPMN file. Instead, do you mean I have to write a JS Job Worker and write “a + b” inside. In short, WHERE appears “a + b”?

<bpmn:scriptTask id=“calculate-sum” name=“Calculate sum”>
bpmn:extensionElements
<zeebe:taskDefinition type=“script” />
zeebe:taskHeaders
<zeebe:header key=“language” value=“javascript” />
<zeebe:header key=“script” value=“a + b” />
</zeebe:taskHeaders>
</bpmn:extensionElements>
</bpmn:scriptTask>

Hi @Bab64,

here is a generic worker that can evaluate scripts in different programming languages: GitHub - camunda-community-hub/zeebe-script-worker: Zeebe worker for script evaluation

The scripts are defined in the Process model and executed in this worker.

You have to configure the worker to access your SaaS cluster with your credentials.

Hope this helps, Ingo

Thanks Ingo. In the meantime, I’ve understand (I hope) all. However, to close this thread I’ll try to clarify for future Camunda 8 users. BTW, the doc. is sorely missing screenshots, although the XML helps…

  1. Write your script as shown in the XML above or, more simply, through the Web modeler (see my screenshot).
  2. Fill in the Task definition type with “My_job_type” (instead of “script” which is generic and thus highly confusing. The doc. misses the point that “My_job_type” is “simply” used at JOB WORKER creation time with zbcli (Zeebe Command Line Interface to interact as client with your Camunda 8 processes, etc.) for instance.
  3. Zeebe does not execute the script. Zeebe executes and controls the worker within the BPMN. The JOB WORKER executes the script (see Ingo GITHUB example).
    Hope this helps forthcoming users…

Correct.

All job workers use the external task pattern. The broker does not execute any user code, but simply orchestrates the BPMN.

The Task definition type is effectively the task “topic” that your external worker will poll for, to get jobs for that task.

The Zeebe script worker is a job worker that uses custom headers to allow you to embed a script in a service task.

The task type, when using this worker, should be set to script, because this worker polls for jobs whose task type is script (by default). The worker can be configured to poll for a different type, see here.

If you are using the CLI zbctl to create a job worker, then you set the task type in the BPMN model and in the zbctl command to be the same, so that the created job worker subscribes to the appropriate task type.

Hope this helps to clarify things.
Josh