Live data from Hacker News

The Dual Nature of Events in Event-Driven Architecture

reactivesystems.eu

61–66 of 66 posts

Re: The Dual Nature of Events in Event-Driven Architecture

#61
post #38

Earlier quoted context omitted.

So... you're not using event-driven architecture. That's fine, but I don't know why it supports this article's weird point about event-driven architecture.

> So... you're not using event-driven architecture. That's fine, but I don't know why it supports this article's weird point about event-driven architecture. I've never used EDA, just read about it, so I'm curious what you disagree with from the article. It seems that the logic is reasonable, that subscribers have varying needs and publishers would need to account for those needs over time as the functionality (and d…

[deleted]

Re: The Dual Nature of Events in Event-Driven Architecture

#62
post #6
post #3

The triggering of the action is a direct consequence of the information an event contains. Whether or not an action is triggered should not be the responsibility of the event. If you are writing events with the intention of having them invoke some specific actions, then you should prefer to invoke those things directly. You should be describing a space of things that have occurred, not commands to be carried out. By…

Thanks for your feedback, I appreciate it! > The triggering of the action is a direct consequence of the information an event contains. Whether or not an action is triggered should not be the responsibility of the event. I agree, but still for different consumers events will have different consequences - in some consumers it'll trigger an action that is part of a higher-level process (and possibly further events), in…

> I think that's the core of event-driven architecture that events drive the process, i.e. will trigger certain actions.

In an event-driven system, there is neither guarantee not expectation that an event will trigger an action; it might, but it might not. Events are simply a log [0] of "things" happening in various subsystems, published to various channels for other subsystems to ignore or act upon on their own terms.

Let say that we have two subsystems - A and B. When something happens on A, it will emit a corresponding event (e.g. SomethingHappened) to a specific channel (e.g. EventsFromA); if B is listening to that channel, it can "recognise" that event and initiate (i.e. "trigger") some action of its own.

However, if A explicitly wants B to do something, it's a command, i.e. a direct coupling by definition. As GP states, that is better handled as a direct request from A to B.

Theoretically, there is a possible scenario where A "knows" that a certain action needs to happen in the system, but does not know which subsystem has that capability, i.e. has no knowledge that B can do that. In that case it can "request" something to happen, e.g. by submitting an event like "UserCreationRequested"; however, there is no guarantee that any service will "see" that event and act upon it.

[0] https://engineering.linkedin.com/distributed-systems/log-wha...

Re: The Dual Nature of Events in Event-Driven Architecture

#63

Earlier quoted context omitted.

It should be an atomic transaction, double-entry style, so it can’t fail between commas. The important thing is not having money go missing.

The only way that is possible is if the tables exist on the same database server. Otherwise, you are right back at distributed transaction problems.

That's the whole point of double-entry. You don't split the entries.

Re: The Dual Nature of Events in Event-Driven Architecture

#64
post #55

Thank you for this well-written, well-reasoned, and thoroughly enjoyable article! Yet I am troubled by it, and must disagree with some of the premises and conclusions. Only you know your specific constraints, so my 'armchair architecting' may be way off target. If so, I apologize, but I was particularly disturbed by this statement: "events that travel between services have a dual role: They trigger actions and carry…

Thank you for your kind words! > Yes, sort of, but mostly no. Events do not "trigger" anything. The recipient of an event may perform an action in response to the event, but events cannot know how they will be used or by whom. I don't see the difference. Maybe it's a language thing. But I'd say if a recipient receives an event and perfoms an action as consequence, it's fair to say the event triggered the action. The…

>Thank you for your kind words!

You're welcome, sorry for the delayed response.

>>...Events do not "trigger" ... >I don't see the difference

Yes, sorry, I'm being pedantic without context - to the uninitiated, the expression "events trigger actions" may be confusing, as it implies that events are active/actors/participants with 1:1 correspondence with reactions, omitting the recipient's agency.

>"two types of..."

...meh; I am/was both, and many other roles, but you are correct in that I hold the problem/solution domain as primary, and prefer to keep the implementation domain out of it as much as possible.

>Doesn't having it in the event payload carry the same information, just in a different place?

Yes, grouping and filtering is absolutely 100% functionally equivalent. But it is not free.

>Why?

Thanks for asking!

BookingUpdated(Reason) looks to me like an unnecessary coupling/corruption of the implementation model and domain model. This may cause additional cognitive load (user confusion/search/explanation) and possibly impact the event-routing mechanisms significantly.

For example:

* a consumer desiring only SeatReserved events will not find that as a topic. Instead, they will have to (unnecessarily) learn something about the implementation model (BookingUpdated:Reason==SeatReserved) in order to find what they want.

Slightly annoying, maybe no big deal w/better topic search or docs, just one example of a tiny unintended consequence.

* where is the selection/filtering performed? broker or consumer? Filtering is probably not free for a single-topic-per-stream implementation; something pays the price for it.

Possibly also no big deal under ordinary circumstances... but here's one way things might go wrong:

* SeatReserved events likely happen more often than the other types due to timeouts, conflicts, and retries. Ordinarily not a problem, but when hot tickets first go on sale the flood of traffic from people and bots competing for the best seats may cause SeatReserved events to increase far out of proportion with the others.

But hey, that's what autoscaling cloud services as for, right?. If the broker handles filtering, that cloud bill might be a bit scary. If consumers handle filtering, every service consuming any type of BookingUpdated event will also have to scale up too, and that bill might be terrifying. :)

With independent topics/streams/tables for each discrete concept, SeatReserved can scale independently, its traffic cannot directly affect services that do not care about it, and the names of topics and events directly reflect the problem/solution domain.

>EDA resourse repo

Excellent collection, thanks for sharing it!

While the need for "wide" events can be symptoms of other design issues, decorating base events is a good solution when they are necessary. If you really need an aggregated BillingUpdated(Reason) event, for example, you can generate it downstream and preserve the independence of the individual event types.

Offhand, I can only think of one situation where capturing the full state of the source entity in an event would be necessary: when it's ephemeral - but that sounds like a larger discussion (perhaps after enjoying a few videos from your collection).

Thanks again!

Re: The Dual Nature of Events in Event-Driven Architecture

#65

Earlier quoted context omitted.

The only way that is possible is if the tables exist on the same database server. Otherwise, you are right back at distributed transaction problems.

That's the whole point of double-entry. You don't split the entries.

Then this is off-topic af. We are talking about distributed systems here.

Re: The Dual Nature of Events in Event-Driven Architecture

#66
post #55

Earlier quoted context omitted.

Thank you for your kind words! > Yes, sort of, but mostly no. Events do not "trigger" anything. The recipient of an event may perform an action in response to the event, but events cannot know how they will be used or by whom. I don't see the difference. Maybe it's a language thing. But I'd say if a recipient receives an event and perfoms an action as consequence, it's fair to say the event triggered the action. The…

>Thank you for your kind words! You're welcome, sorry for the delayed response. >>...Events do not "trigger" ... >I don't see the difference Yes, sorry, I'm being pedantic without context - to the uninitiated, the expression "events trigger actions" may be confusing, as it implies that events are active/actors/participants with 1:1 correspondence with reactions, omitting the recipient's agency. >"two types of..." ...…

correction: the frequency/volume of SeatReserved events may suddenly spike
Post reply on HN