3 ms·
Seems to me a solution is to have a "generic" queue handler that will take any message, and then have tenant specific queue handlers. Now, mind, I'm not thinki
by whartung 3y ago
Seems to me a solution is to have a "generic" queue handler that will take any message, and then have tenant specific queue handlers.
Now, mind, I'm not thinking of a dedicated handler for each tenant, rather one that can round robin, or rotate through the tenants to pull items specific to that tenant off the queue. This can be the "fairness" arbiter.
With the Postgres SKIP LOCKED technique, you can be selective as to which messages you pull (you're not limited to the head of the queue, but can dig deep if you want).
So, you have one general purpose "head of the line" handler, and then one (or several) that acts like the fellow at the Post Office "Anyone here just picking up mail?", and pull them out of the queue.
Of course the generic version can just switch modes (every 1m, or 100 messages, go into "fair mode" for a short time), vs having different handlers.