29
votes
Applicability of Single Responsibility Principle
Sending a notification that the persistent data store changed seems like a sensible thing to do when saving.
Of course you shouldn't treat Add as a special case - you'd have to fire events for Modify ...
24
votes
Accepted
How do desktop applications get notified of events over the internet?
Be aware that to be able to send an information, the sender needs to know the target.
Normally the client knows the server. But the server has no clue about the clients until they try to connect.
...
16
votes
Applicability of Single Responsibility Principle
Yes, it is a violation of the single responsibility principle and a valid point.
A better design would be to have a separate process retrieve 'new users' from the repository and send the emails. ...
14
votes
Accepted
Applicability of Single Responsibility Principle
Yes, it can be a valid requirement to have a repository which fires certain events on certain actions like Add or SaveChanges - and I am not going to question this (like some other answers) just ...
12
votes
API Gateway (REST) + Event-Driven Microservices
Repeat after me:
REST and asynchronous events are not alternatives. They're completely orthogonal.
You can have one, or the other, or both, or neither. They're entirely different tools for entirely ...
10
votes
Accepted
How to represent a loop in Event Storming?
Event storming is not a notation
Event storming is not a notation. It's a very interactive team practice based on sticky notes put on a board and rearranged as the modeling progresses.
It starts with ...
9
votes
DDD: Where to place domain event handlers?
I place Domain Event Handlers in Domain layer as a domain interface IDomainEventHandler.
An example of a Domain Event Handler is a policy that subscribes to certain domain event in order to ...
9
votes
Accepted
Was including a keyword for events a mistake in C#?
The point of an event is that it doesn't allow outsiders to get or overwrite all event handlers. An event essentially a specialized kind of property, which has add/remove instead of get/set.
The ...
8
votes
Accepted
How to deal with an event if the domain aggregate was not yet persisted?
The problem you've encountered has a lot to do with messaging implementation.
The solution of the problem you're describing depends on many variables and it is very difficult to reliably take into ...
8
votes
How to resolve cyclic dependencies in Event-driven systems?
You can solve this by creating two additional packages
SalesEvents(OrderPlaced)
BillingEvents(PaymentReceived)
instead of one Events package. It should be clear that the cyclic dependency ...
8
votes
Should I send the current or previous state with my state changed event?
It won't hurt to include both OldState and NewState as properties of e. It could be convenient to the subscriber, who would not need to keep track of the current state and could perform updates only ...
7
votes
How to write integration tests for a distributed system highly dependant on current date and flow of time?
Never manipulate the actual time time or speed of the system you are testing on just to test time logic. It's hard to get right and may have lots of unforeseen side effects.
Instead, decouple all ...
7
votes
Applicability of Single Responsibility Principle
Is this a valid point?
Yes it is, although it depends a lot on the structure of your code. I don't have the full context so I will try to talk in general.
It seems to me that the raising an event ...
7
votes
Event bus vs PubSub
For the "publisher/subscriber" pattern, subscriber components have to subscribe (or unsubscribe) to an event publisher. This means the life time of the event publishers is as least as long ...
6
votes
Accepted
How can we keep sight of business flows in event driven architectures?
The problem is that it can be hard to see such a flow as it's not explicit in any program text. Often the only way to figure out this flow is from monitoring a live system.
There are two separate ...
6
votes
C# How to avoid memory leak in this case
Why not unsubscribe when window closes? Thats normally how event aggregation works. You can also use weak references. Thats how I did in this event aggregator for a open source application
public ...
5
votes
Was including a keyword for events a mistake in C#?
The main value of an event being a first class citizen in the .NET world (that I can think of) is that it is recognizable through reflection across language implementations. This allows one developer ...
5
votes
Accepted
How to model User behaviour that can be shared between microservices in Event Driven architecture?
When a user registers I assume they specifically opt-in to receive notifications due to legal reqiuirements such as the GDPR regulations in the EU. Therefore you could have two events during user ...
5
votes
How to handle data inconsistency in microservice architecture?
I believe there's three typical ways you could handle this:
Guarantee delivery of your messages
Run a reconciliation process
Switch to a pulled events approach
A little detail on each approach...
...
4
votes
Applicability of Single Responsibility Principle
SRP is, theoretically, about people, as Uncle Bob explains in his article The Single Responsibility Principle. Thanks Robert Harvey for providing it in your comment.
The correct question is:
Which "...
4
votes
When to publish domain events when handling transactions in the application service
Have you considered to use the Outbox pattern? Saving the domain events into the database as well and dispatch them from the database (via a separate worker or by an out-of-the-box database-messaging ...
4
votes
Accepted
Applications interested to the same event and concurrency
You can rarely guarantee the execution order of anything concurrent; therefore, the obvious solution although not necessarily satisfying is to sequence the operations. Some suggestions to do that:
...
4
votes
How do desktop applications get notified of events over the internet?
The client can simply connect to the server, identify itself, and leave the connection open without doing anything special. When something happens, the server can send some data to the client.
Nothing ...
4
votes
Should I send the current or previous state with my state changed event?
In typical implementations of the Observer pattern, the subject being observed notifies all subscribed observers that its state changed by sending an event that also includes the new state.
Exceptions ...
4
votes
Should I send the current or previous state with my state changed event?
In short
To encourage a sound separation of concerns, prefer StateChanged with only the new state. Consider StateChanging with care, as it risks to create hidden coupling (e.g. the receiver may be ...
4
votes
How do event sourcing services recreate the state of an entity?
So the usual answer is that instead of using an event delivery system, like Kafka, the "book of record" is a database (could be relational, could be a document store, could be an "event&...
4
votes
How to propagate seldomly changing data in a distributed system
In this answer, I'm going to use SLA to mean the maximum amount of time that a downstream system can be behind the primary source.
There are basically two options here:
Downstream systems poll for ...
4
votes
Ordering events across multiple topics in a distributed system
An obvious solution seem to be to use a single topic for events that needs to be ordered. You could use a single ProductStatus topic, with the type of status inside the message.
Another possible ...
4
votes
Accepted
How to handle events representing cross-domain knowledge
Typically, accounts payables and account receivables are sub-ledgers in the accounting context. They register accounting transactions with vendors and customers.
Accounting transactions with vendors ...
3
votes
Where does the responsibility for clearing higher-level caches lie in a pyrimidal calculation system with caching at multiple levels?
Each cache subscribes to one or more data sources, and is a data source for the next higher layer (cache or application/user reading the final result).
Each data source provides a value and a change ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
event × 105c# × 20
microservices × 20
domain-driven-design × 13
architecture × 11
event-sourcing × 11
design × 9
design-patterns × 8
event-handling × 8
javascript × 7
event-programming × 7
message-queue × 6
distributed-system × 6
messaging × 6
eventual-consistency × 6
.net × 4
asynchronous-programming × 4
api-design × 3
architectural-patterns × 3
rabbitmq × 3
command-message × 3
c++ × 2
unit-testing × 2
api × 2
multithreading × 2