In this chapter, you looked at the Publish/Subscribe pattern. There are many interpretations of the Publish/Subscribe pattern. Some interpretations simply mirror the Observer pattern. Other interpretations completely separate publisher and subscriber and have an intermediate service that acts as a conduit from publishers to subscribers. In this chapter, I chose the latter interpretation and used the FSP (formerly the Jiro platform) event service as an example outside the scope of Web Services.
The structure of the Publish/Subscribe pattern includes three concrete implementations . An event service, derived from a WSDL interface, is a conduit between publishers and subscribers. A subscriber, derived from a WSDL interface, receives messages from the event service. A publisher publishes messages to the event service. The publisher is the only structure that does not have an associated interface. The primary difference between publish and subscribe is the separation of the state or events that a subscriber is interested in away from the structure responsible for delivering events to the subscribers.
You have now seen three different mechanisms for using events from the Web Service paradigm. The first, the event monitor, placed the burden of event recognition on the client of a Web Service. The second and third required the subscriber, or observer, to be Web Services themselves . In implementing the latter two patterns, there are two major disadvantages exposed. The first disadvantage is that the subscriber Web Services had no way to converse with a more robust main program, such as a servlet or Java Server Page (JSP). The subscribers were simply stand-alone Web Services that received messages and printed information. The second disadvantage is the weight that the subscribers bring to the client programs. To implement a subscriber, you used Apache Tomcat (a servlet engine), Apache Axis (the Web Service container), and the subscriber service itself. This makes the footprint of a client program huge and the installation relatively complex. In the next two chapters, you will look at patterns to help mitigate these problems.