Generally speaking, use WorkerPool to allow multiple collaborative workflows to work with a single consumer, which is good if you have tasks that are independent and potentially variable in duration (for example: some short tasks, some longer).
Another option is to simultaneously execute several independent workflows on events, but each worker processes only handlers modulo N (for example, 2 threads and one thread are odd, one thread even processes event identifiers). This works great if you have ongoing processing tasks of duration, and also allows batch processing to work very efficiently.
Another thing to consider is that the consumer can perform โbatch processing,โ which is especially useful, for example, in auditing. If your consumer has 10 pending events, and not to write 10 events to the audit log independently, you can collect all 10 events and record them at the same time. In my experience, this more than covers the need to run multiple threads.
source share