Push-based outbox pattern with Postgres logical replication
event-driven.io
event-driven.io
1: https://debezium.io/documentation/reference/stable/transform...
I take your point though, that WAL is less limiting in this regard.
[0] https://hackage.haskell.org/package/postgresql-replicant
Cool to know this is an option though, but I much prefer not relying on database internals like wal logs, this hurts scaling more IMO.
The only thing you need to worry about with the table method is out of order increment IDs, which is always possible in a transactional database. But there are many solutions for this.
https://github.com/vippsas/mssql-changefeed/blob/main/MOTIVA...
I wish DBs had this more built in, it seems a critical feature of a DB these days and the commit log already have very similar sequence numbers internally...
E.g., with Azure Cosmos DB -- you would not use the postbox pattern there. You listen to the DB change feed -- since that is provided and is easily accessible.
2) In our case the schemas in SQL are mostly event based already (we prefer insert over update ...even if we do business logic/flexible querying on the data). So using an event store is mainly a duplication of the data.
An event store is a database too. What exactly is it about a database that makes it a "proper event store"?
I honestly think the focus on duplicating data you have in your DB in a separate event store DB too may be something of a fad that will pass in a while -- similar to NoSQL. It's needed for volumes larger than what a SQL DB can handle, but if you don't need such large volumes why introduce the extra component. Event sourcing architecture is great; but such thinking on an architecture level is really orthogonal to the storage and transport chosen.
A bit hacky, but on AWS RDS we didn’t want to deal with wal intricacies.
https://mattjames.dev/auto-increment-ids-are-not-strictly-mo...
Perhaps this is what you mean with "out of order increment"... but what are the "many" solutions to this?
I struggle for a long time to find a good way of doing this in Microsoft SQL and still not perfectly happy about the solution we found.
but, disk isn't usually infinite.
I had imagined the GP might have been insinuating something like: a configurable number of WAL files would be written, then they'll be overwritten once all full.
The application can catch up when restarted, if it retains the last WAL position. When it restarts, can asks Postgres to start replaying from that point.
I agree with the goal -- one should definitely never publish an event externally before it is committed to DB! But I think using a "post-commit sequence number" is even more powerful than the outbox pattern.
Sadly few DBs seems to supoort this well with low latency. CosmosDB has great support for a post commit low latency change feed
A hack for mssql is here:
https://github.com/vippsas/mssql-changefeed/blob/main/MOTIVA...
More about this way of publishing events:
Here is a comment and link to some code which seems to work: https://github.com/sfackler/rust-postgres/issues/116#issueco...