News for hackers. Stuff that matters.
Re:Event Sourcing, CQRS and Micro Services: Real FinTech Exa... by javcasas on Saturday October 18, 2025 @12:59PM (#45628736)
Yeah, that's a big NO. Events are immutable. If an event is wrong, you post an event with an amendment. Then yes, rebuild the app state.
Re:Event Sourcing, CQRS and Micro Services: Real FinTech Exa... by saxenaabhi on Saturday October 18, 2025 @01:01PM (#45628752)
Not speaking about their case, but I think some cases a "versioned mutable data store" with a event log that lists updates/inserts makes more sense than an "immutable event log" one like kafka.

Consider the update_order_item_quantity event in a classic event sourced systems. It's not possible to guarantee that two waiters dispatching two such events at same time when current quantity is 1 would not cause the quantity to become negative/invalid.

If the data store allowed for mutability and produced an event log it's easy:

Instead of dispatching the update_order_item_quantity you would update the order document specifying the current version. In the previous example second request would fail since it specified a stale version_id. And you can get the auditability benefits of classic event sourcing system as well because you have versions and an event log.

This kind of architecture is trivial to implement with CouchDB and easier to maintain than kafka. Pity it's impossible to find managed hosting for CouchDB outside of IBM.

Re:Event Sourcing, CQRS and Micro Services: Real FinTech Exa... by javcasas on Saturday October 18, 2025 @01:08PM (#45628806)
Any modern DB with a WAL (write ahead log) is an immutable event system, where the events are the DB primitives (insert, update, delete...).

When you construct your own event system you are constructing a DB with your own primitives (deposit, withdraw, transfer, apply monthly interest...).

You have to figure out your transaction semantics. For example, how to reject invalid events.

Re:Event Sourcing, CQRS and Micro Services: Real FinTech Exa... by saxenaabhi on Saturday October 18, 2025 @01:16PM (#45628862)
> Any modern DB with a WAL (write ahead log) is an immutable event system, where the events are the DB primitives (insert, update, delete...).

Agreed, I just wish apart from WAL they also had versioning as first class and their update api required clients to pass the version they have "last seen" to prevent inconsistencies.

Re:Event Sourcing, CQRS and Micro Services: Real FinTech Exa... by javcasas on Saturday October 18, 2025 @01:56PM (#45629176)
On most SQL databases, you can put CHECK constraints on columns so that the database rejects events. But this is controversial, as people don't like putting logic on the DB.
Re:Event Sourcing, CQRS and Micro Services: Real FinTech Exa... by serbrech on Saturday October 18, 2025 @03:22PM (#45629746)
CosmosDB has etags on every document
Re:Event Sourcing, CQRS and Micro Services: Real FinTech Exa... by marcosdumay on Saturday October 18, 2025 @03:22PM (#45629743)
DBs only work because the events are artificial and nobody cares about what's written in them.

And DBs are not really CQRS because the events are artificial and don't have business data that people are interested in keeping.

Re:Event Sourcing, CQRS and Micro Services: Real FinTech Exa... by throwup238 on Saturday October 18, 2025 @01:07PM (#45628799)
The big caveat here is GDPR and other privacy laws. In some cases you need the ability to scrub the event store completely of PII for legal reasons, even if only to null the relevant fields in the events.

Without preemptive defensive coding in your aggregates (whatever you call them) this can quickly blow up in your face.

Re:Event Sourcing, CQRS and Micro Services: Real FinTech Exa... by javcasas on Saturday October 18, 2025 @01:11PM (#45628829)
What I have read about it is: encrypt PII with a client-depending key, do not post the key to the event system. When an erasure request comes in, delete the corresponding key. Now the data cannot be decrypted anymore for that client.
Re:Event Sourcing, CQRS and Micro Services: Real FinTech Exa... by mattmanser on Saturday October 18, 2025 @03:50PM (#45629931)
That is some serious architecture to put in place before you can even start using event sourcing.
Re:Event Sourcing, CQRS and Micro Services: Real FinTech Exa... by Netcob on Saturday October 18, 2025 @05:19PM (#45630423)
That's what I said too, and the answer was "No, just because it cannot be decrypted today does not mean it cannot be decrypted in the future. The data must be deleted"
Re:Event Sourcing, CQRS and Micro Services: Real FinTech Exa... by ndriscoll on Saturday October 18, 2025 @01:16PM (#45628863)
For finance recordkeeping requirements take precedence over privacy requirements. Audit trail data must be on WORM storage and must not be scrubbable.