This will ensure that only one publisher is writing to the log at a time, preventing out-of-order message delivery or interleaving messages from different publishers onto the same stream.
This could be implemented with a ZooKeeper lock, or an advisory lock on the origin database. (This can't be done with a LOCK statement on the origin database itself, since that lock would be released at the end of the transaction when a batch is committed to PgQ.)
I think the ideal solution here would be the ZooKeeper lock, although that would be more complex than using an advisory lock. (Using advisory locks for something like this feels like a bit of a hack to me since they aren't namespaced in any meaningful way.)
This will ensure that only one publisher is writing to the log at a time, preventing out-of-order message delivery or interleaving messages from different publishers onto the same stream.
This could be implemented with a ZooKeeper lock, or an advisory lock on the origin database. (This can't be done with a LOCK statement on the origin database itself, since that lock would be released at the end of the transaction when a batch is committed to PgQ.)
I think the ideal solution here would be the ZooKeeper lock, although that would be more complex than using an advisory lock. (Using advisory locks for something like this feels like a bit of a hack to me since they aren't namespaced in any meaningful way.)