Task Queue per Customer or other approach?

Hi :),

We are thinking of re-creating our current system and using Temporal to do most of the heavy lifting.
I am new to Temporal and I’ve read most of the docs and have an example solution for our problem in my head, but would love to verify if that is the best way to implement it or if it is even possible. So the example problem is as follows:

In the future we will have (let’s say) 1M customers. Each of which could initiate different Workflows like 1) Pay an Invoice, 2) Change their Address, etc… I don’t want to handle what happens if the Customer changes their Address while paying an Invoice (let’s say there is some awaiting in the middle of the 1) Pay an Invoice Workflow or whatever), so I would like all Workflows for a specific Customer to be queued and executed one after another (Workflows are expected to be 1-5 minutes long max, not 2 years or something like that). I am imagining that a Task Queue per Customer and some settings on the Task Queues could theoretically do this, but are 1 mil Task Queues possible and/or advisable? Or is this done in a completely different way?

Any of your thoughts and questions are greatly appreciated!

The standard approach is to send signals to a workflow with a workflow ID equal to customer ID using SignalWithStart. The semantics of SignalWithStart is that it delivers a signal to an already running workflow, and it starts a workflow and then delivers the signal if the workflow is not currently running.

Inside the workflow, you queue up delivered signals and process them according to your business logic. So you don’t queue up entire workflows, but queue up requests to these workflows.

So no need to mess up with task queues for this use case.

1 Like