Skip to content

✨ Outbox pattern #570

@Hulkstance

Description

@Hulkstance

When processing domain events, there are two ways:

  • Immediate consistency (before the SaveChangesAsync call), which is useful for cases like creating an order and its corresponding historical order where one doesn't make sense without the other. Domain events are basically part of the same transaction. We've implemented this using separate interfaces IPreDomainEvent (immediate consistency) and IPostDomainEvent (eventual consistency)
  • Eventual consistency (after the SaveChangesAsync call), where domain events are basically a separate transaction. The issue we ran into with this in prod (large userbase), was that if the user closed their browser mid-request, some domain events wouldn't fire up. You solved this by queuing them up using the HTTP context while the user is still online, which is great.

That said, I wonder if you guys considered the Outbox pattern? It's kind of related to integration events, i.e. #123, not sure what the current progress on that is

References:

It's a bit off topic, but I just wanted to say I'm really impressed by your template. You've solved the same problems we did, but in a different way. I especially like how you handled domain invariants and kinda "unified" EF Core configurations with FluentValidation. Really great job!

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type: FeatureA suggested idea for this project

    Type

    No type
    No fields configured for issues without a type.

    Projects

    Status

    No status

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions