Java Reference
In-Depth Information
The beans that need to be notified may change over time and a new module might be ad-
ded to the application—obviously you don't want to edit the
BidController
each time.
The
ItemController
therefore fires an event, which other beans, including
Land-
ingController
and
TwitterNotifier
, are listening to and waiting to act upon.
Using CDI's form of the observer pattern results in code with low coupling—
ItemCon-
troller
doesn't have a reference to these other beans, and the other beans that are listen-
illustrates the event-delivery process.
Figure 12.4. Events triggered by
addItem