Event Filtering
The last thing we'll focus on in this chapter is the issue of event filtering. You might remember from early on that a major problem with tightly coupled event systems is that they do not allow for a generic means of filtering out the events you don't care about. After all, where would this code go in a tightly coupled event system? You can't put it in the publisher because the publisher might have many different subscribers, all of whom have different (possibly dynamic) filtering needs. You certainly don't want to put the event filtering logic in the subscriber because that would mean the subscriber would still incur the overhead of having to receive every notification of a given type before it could decide whether it even cared ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access