Skip to content

Commit 919a98d

Browse files
committed
Added Event Aggregator pattern description.
1 parent ca59792 commit 919a98d

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
* [Double Checked Locking](#double-checked-locking)
3939
* [Servant](#servant)
4040
* [Null Object](#null-object)
41+
* [Event Aggregator](#event-aggregator)
4142

4243
## <a name="abstract-factory">Abstract Factory</a> [&#8593;](#list-of-design-patterns)
4344
**Intent:** Provide an interface for creating families of related or dependent objects without specifying their concrete classes.
@@ -391,6 +392,14 @@
391392
**Applicability:** Use the Null Object pattern when
392393
* You want to avoid explicit null checks and keep the algorithm elegant and easy to read.
393394

395+
## <a name="event-aggregator">Event Aggregator</a> [&#8593;](#list-of-design-patterns)
396+
**Intent:** A system with lots of objects can lead to complexities when a client wants to subscribe to events. The client has to find and register for each object individually, if each object has multiple events then each event requires a separate subscription. An Event Aggregator acts as a single source of events for many objects. It registers for all the events of the many objects allowing clients to register with just the aggregator.
397+
398+
![alt text](https://github.com/iluwatar/java-design-patterns/blob/master/event-aggregator/etc/classes.png "Event Aggregator")
399+
400+
**Applicability:** Use the Event Aggregator pattern when
401+
* Event Aggregator is a good choice when you have lots of objects that are potential event sources. Rather than have the observer deal with registering with them all, you can centralize the registration logic to the Event Aggregator. As well as simplifying registration, a Event Aggregator also simplifies the memory management issues in using observers.
402+
394403

395404
# Frequently asked questions
396405

0 commit comments

Comments
 (0)