Composite task

Hi there,
I am trying to implement the following composite task:

  1. it should act as service task i.e. being able to have custom implementation and accept properties/variables (from PBMN)
  2. it should be able wait for user input (i.e. like user task)

As far as I understand, there is no way to extend an user task (other then using ExecutionListener) and I can’t find any way how to lock/suspend the execution of service task programatically (to simulate user task behaviour).

Are there any other ways to implement it?

Hi @vicmosin,

you can model your task as an external service task. The implementation is similar to a user task: you need to complete the task explicitly by code. This code could be triggered by a user input (in a different frontend).

Have a look at the docs for further details: External Tasks | docs.camunda.org

Hope this helps, Ingo

Thanks for your idea @Ingo_Richtsmeier ,
but here is the case…

I do have a lot of repeated tasks:
Bildschirmfoto 2021-04-30 um 12.34.40

So my idea is to try to accumulate these into a single custom task which will act as both service and user tasks, i.e. first will trigger some custom logic, second - will wait for a user’s input… This way the BPM will become much easier and twice shorter (since all of these repeated tasks will be replaced with a single one).

Your proposal with external service will work, but will still require 2 tasks at BPM level.

@vicmosin,

not nessesarily. You can put the logic of waiting for the user input into the code of the external task worker, together with the implementation of the first service task Ask title. And replace both tasks with a single service task.

This will reduce the readability of your process model, and I personally would not go this way. But technically it’s possible (with some coding in the background).

Hope this helps, Ingo

@Ingo_Richtsmeier
could you please point to me some piece of code which shows how to wait for an user’s input?

And wouldn’t you go this way? Only because of readability issue or there is some hidden stone behind it?

Thanks!

Hi @vicmosin,

this is the palce where to put business logic: camunda-bpm-examples/App.java at 7.15 · camunda/camunda-bpm-examples · GitHub

As an old school java programmer, I would poll for some database row where the user changes a value through a service called by a web interface. I’ve about webSockets as a modern technology, but never used them by myself…

Beyond readability it’s obviously much more effort to get it done, as I can’t use the available solution tasklist any more.

Another alternative is to call the code from Ask title in a execution listener on the start event. The listener is executed before the user task is created and not visible in the process model.

BPMN and Camunda are very flexible here, but the best is to model your process as explicit as possible.

Hope this helps, Ingo

Thanks for your explanation @Ingo_Richtsmeier