amantinband / clean-architecture

The ultimate clean architecture template for .NET applications 💪
MIT License
1.53k stars 254 forks source link

[Question] Isn't the Eventual Consistency Middleware coupling Infrastructure to Presentation? #31

Open Thijs153 opened 6 months ago

Thijs153 commented 6 months ago

Hi @amantinband,

I have a question concerning the Eventual Consistency Middleware.

By implementing an Eventual Consistency Middleware in the infrastructure layer that relies on the HttpContext, you are, in a sense, creating a dependency on a specific presentation mechanism (ASP.NET Core's HTTP handling), i.e. coupling the infrastructure layer with the presentation layer.

If you decide to switch the presentation layer technology (e.g., to a Blazor server application), this will break because there isn't a valid HttpContext available.

What are your thoughts/views about this? I could be wrong, so please correct me if I'm mistaken. Would something like the Outbox pattern be a solution for this?

P.S. This may be unrelated here, but are you ever planning on making a video about the Event Patterns you can implement for scenarios where event 1 sends a success email but event 2 fails, and how to tackle these challenges?