Orchestrator (like Camunda) between frontend and backend?

0

I have the following use case. We have both a frontend application and a backend application. Earlier, events on the frontend application directly call the backend application. Now we want to introduce an orchestrator (like Camunda) between the frontend and backend applications. Following will now be the sequence of events.

  1. User clicks on the button in frontend application. This action is part of a workflow graph and the next node in the graph linked to this button click action is to call the related backend API.
  2. This button click instead of directly calling the related API in backend calls another API that sends a message to a kafka topic.
  3. The orchestrator is listening to this kafka topic and executes the next node in the workflow graph to call the related backend API.

Questions

  1. Is this a correct use case for introducing an orchestrator or the previous method of directly calling backend itself was fine?
  2. For introducing an orchestrator between the frontend and backend applications, are the steps mentioned above correct or there is a better way?
  3. Many a time, we need to show the response of the backend API in the frontend. How can that part be handled when the orchestrator is added and the flow mainly becomes asynchronous?

You can indeed use an orchestration engine for this kind of use case.
A good starting point might be to see how you can orchestrate a services through kafka messages since you’re already using Kafka. That’s described in detail in this blog post.

This can be done, but i’d need to know more details about the expected behavior before suggesting how you might go about it.

Thanks a lot for checking this.

This can be done, but i’d need to know more details about the expected behavior before suggesting how you might go about it.

Expected behavior is just to let the frontend know whether the API call succeeded or not. Would another separate kafka topic be needed for this and the flow would be from backend to orchestrator to frontend (through kafka topic)?

One other doubt I had was the following, could you please also check this?
If the workflow was as follows

user_task_1 => call_API_1 => user_task_2 => call API_2

Both user tasks are button clicks on the frontend application used to manage an entity. When the first button click or user_task_1 happens, a new workflow instance is created. The status of this workflow instance is user_task_1_completed for now. Later when the user_task_2 which is again another button click on the frontend application is completed, how can we retrieve this workflow instance? Just with the entity ID, we can’t retrieve the workflow instance ID as there could be multiple button clicks or workflow instances for the same entity. Is it right to add the workflow instance IDs in the frontend application or there is some better way?

This is pretty straightforward. Assuming that these clicks result in some kind of payload being passed around you can query for a specific process instance based on data that you’ve sent with your click. This can act like a correlation key.