Multiple producer and consumer generalisation of a persistent queue

A producer can atomically push operations onto a persistent queue, independently from a consumer which in effect pops from the queue using a local transaction which increments a sequence number. There is no need for distributed transactions.

This pattern can be generalised for where there are N producers.

This just means repeating the same pattern N times. Rather than the consumer persisting a single sequence number in its database, it instead records a sequence number for each producer. This is called a vector time.

To also generalise to multiple consumers, we simply have each consumer independently record a vector time in its local database to keep track of what has been processed by that consumer.