The OSGi EventAdmin
service provides a simple means to implement an event-driven application model in an OSGi runtime, and uses topics made of string identifiers separated by slashes to partition the namespace for events. An Event
contains a number of key/value pairs, using String
keys and primitive or String
values, which can then be received by EventHandler
implementations.
Handlers are registered as standard OSGi services, and can take advantage of filtering based on event contents as well as topic names or prefixes. Events are used heavily within the Eclipse E4 platform, and there are E4-specific annotations @EventTopic
and @UIEventTopic
that can be used to invoke methods upon receipt of particular events.
Finally, the chapter presented how event-driven applications can be designed along with a comparison of event-driven and message-driven services. Although superficially similar, message-driven systems often deal with persistence, transactions, and queues as well as topics.
The next chapter will look at how Eclipse P2 is used to generate update sites and what additional information can be encoded into P2 installers.