Search code examples
vaadincamundabusiness-process-managementflowable

How to control of UI (e.g. Vaadin) through "camunda" or "flowable" bpms?


Hello!

I have a problem with Camunda or Flowable BPMS. I need to change my UI depending on the business process.

For instance:

  1. I have a process A (user task) and camunda (flowable) should generate a form in Vaadin. Then it should wait for user activity and continue... (or camunda needs just call vaadin form and wait for ending processing in backend and get some response)
  2. If I have another process, camunda should generate another form, etc.

Does this approach make sense? Or would be more appropriate to use bpms such as camunda to use for business processes only (not for user interface)?

Thanks in advance!


Solution

  • Process Engines work with the principle that only the current task matters and the engine knows (via bpmn model) what to do next. You give up the total control of the flow and thereby gain simplified updates and modifications. The engine works asynchronously and the user completing a task has no idea (and does not need to) which next activities will be taken.

    That being said, process engines are normally not a good match for "wizard" like UI flows. The engine treats "TaskA" as a single task, persists it and then creates an unsigned "TaskB" in the tasklist, that can then again get claimed and worked on by a user (not necessarily the same user).

    However, if you want to stick to your approach, have a look at the UI Mediator pattern which is a behavoral pattern that hides the underlying asynchronous continuation from the "wizard" user.

    There is an older, but still helpful blog post that describes how to adapt the pattern to the camunda process engine. Basically, you block and wait after the user completed a task and if the follow up task is again meant to be worked on by the user, you redirect to it.