Best practice for coupling angularJS frontend to Camunda backend

Hi,

i was wondering how is the best way to communicate results (e.g. from a DMN Task) back to a angularJS or generic JS Frontend.

Usecase:
I start a process via the REST Interface from a frontend , providing some input variables to the process engine (some input data by the user from the frontend GUI). This variables are evaluated by a BusinessRuleTask (DMN) followed by some Service Tasks to process the results.

These results, which are the results of the evaluation of the provided input data, should then by displayed to the user on the frontend.
I could send the Input data to the process and then poll the process via rest until it hits the end of the evaluation - but is there a more elegant way of doing it? For example getting the result via websockets?

Whats the best practice here?

Ok i did some more research and i’ll try to adapt this approach: http://blog.mwrobel.eu/activiti-bpmn-engine-events-via-websockets/ to camunda.

Another option would be an angular poller service like this: https://github.com/emmaguo/angular-poller
However i think it is more elegant to use WebSockets. Maybe registering to an event via a websocket whilst providing the business key could be a cool enhancement to camunda?

This is a very important question and relates to the ideal architecture between Camunda and any Frontend. I feel that there is not really a vision here from Camunda’s perspective, or is there?
Any Camunda devs / devRel around to point us to some documentation or vision outlining how Frontends should work together with Camunda (or not - and have only backends communicate with it)?

We have similar angular frontend but we are not calling camunda APIs directly. we have custom process/task management component in between that communicates to Camunda and UI retrieves any process/task level data from our custom process and task management component.

We have “CustomEventHandler” built as “ProcessEnginePlugin”, which has the preparsers added with process and task execution listeners. These default listeners are fired every time lifecycle state changes in activities within BPMN and post event with all contextual information for a task and process state change which we capture in our custom process/task management real time and UI pulls those values from custom process/task management component. that way our core BPM process engine(Camunda) remains loosely coupled with custom Angular UI

More around Execution and task listeners can be found here Delegation Code | docs.camunda.org

Hello Harish_malavade, the following is not entirely clear to me:
Can you elaborate what you mean by:
“we have custom process/task management component in between that communicates to Camunda”
You mean to say you have a specific microservice, a separate server with a separate codebase that handles incoming requests from the frontend and decides what needs to be communicated to Camunda and when?

If so, does this service only accept requests from the frontend, and is thus a Backend For Frontend, or does it get used more generally by other components in your architecture and is then more of an orchestrator in itself?

Lastly, what did you use to build this server, the same language you build your backends and/or Camunda workers in, or did you use a specific technology, such as GraphQL to do this?

that way our core BPM process engine(Camunda) remains loosely coupled with custom Angular UI

That is exactly what I am looking for, but I feel that a diagram might help explain your situation :slight_smile:


This is what We have, we dont go to camunda for every data we have custom event handler plugin in camunda that emits process/task events which then gets stored in Event Database and everytime we need data on our UI we will pull it from our custom Database