Best approach for worker to only access one workflow instance - "session"?

Hi,

Assume I have a simple BPN with three process steps. 1) gather info from user, for example via web, chat or any channel, 2) process the input and based on other systems generate a response and 3) present the response to the user. Building a worker for (2) is straightforward for example pick a job from the queue, process the payload and put back updated payload. The (2) worker microservice doesn’t have to care about which workflow instances. It just picks from the queue and puts back the result.

But 1) and 3) only needs to pick jobs from the same workflow instance because otherwise the user would get other users response. So 1) and 3) workers have to only pick jobs for a certain jobtype AND workflow instance ID. And ideally not being able to access any other workflow instance. A “session” concept so to say.

What would be the best process, worker design approach to solve this problem?

Hi @direktoren, thanks for the question. A couple of thoughts here:

• As an aside, it might make sense to model the first step (collecting user input) as a start event that creates a new workflow instance with the user input as payload.

• The “session management” / responsibility of showing the correct response to the user would have to be handled by a system separate from Zeebe. A Zeebe job worker might e.g. push the response to a data store queried by a web application. Unfortunately, there’s not a straightforward way to manage that session concept in Zeebe.

Let me know if you have any follow-up questions.

Best,
Mike