Notification and eventing
With its roots in the messaging-oriented middleware era, the publish-and-subscribe MEP introduces a composite messaging model, comprised of primitive MEPs that implement a push delivery pattern. It establishes a unique relationship between service providers and service requestors where information is exchanged (often blindly) to achieve a form of dynamic notification (Figure 7.37).
Figure 7.37. Once subscribed, service A is notified of anything service B publishes that is of interest to service A.
While notification itself can be applied to different types of MEPs, the focus of this section is a discussion of notification within the context of the publish-and-subscribe pattern.
7.7.1. Publish-and-subscribe in abstract
As explained in Chapter 6, this messaging pattern can be classified as a complex MEP assembled from a series of primitive MEPs. It involves a publisher service that makes information categorized by different topics available to registered subscriber services. Subscribers can choose which topics they want to register for, either by interacting with the publisher directly or by communicating with a separate broker service. A topic is an item of interest and often is tied to the occurrence of an event.
When a new piece of information on a given topic becomes available, a publisher broadcasts this information to all those services that have subscribed to that topic. Alternatively, a broker service can be used to perform the broadcast on the publisher's behalf. This decouples the publisher from the subscriber, allowing each to act independently and without knowledge of each other.
7.7.2. One concept, two specifications
Two major implementations of the publish-and-subscribe pattern exist:
- The WS-Notification framework
- The WS-Eventing specification
Spearheaded by IBM and Microsoft respectively, these use different approaches and terminology to cover much of the same ground. It is expected that a single publish-and-subscribe specification eventually will emerge as an industry standard. The remainder of this section is dedicated to exploring features of both specifications.
7.7.3. The WS-Notification Framework
As with other WS-* frameworks, what is represented by WS-Notification is a family of related extensions that have been designed with composability in mind.
- WS-BaseNotificationEstablishes the standardized interfaces used by services involved on either end of a notification exchange.
- WS-TopicsGoverns the structuring and categorization of topics.
- WS-BrokeredNotificationStandardizes the broker intermediary used to send and receive messages on behalf of publishers and subscribers.
Note
To improve clarity, we take the liberty of breaking up some of the large concatenated terms provided in the WS-Notification specifications. For example, the term "NotificationMessage" in the WS-BaseNotification specification is expressed as "notification message" in this section.
Situations, notification messages, and topics
The notification process typically is tied to an event that is reported on by the publisher. This event is referred to as a situation. Situations can result in the generation of one or more notification messages. These messages contain information about (or relating to) the situation, and are categorized according to an available set of topics. Through this categorization, notification messages can be delivered to services that have subscribed to corresponding topics.
Notification producers and publishers
So far we've been using the familiar "publisher" and "subscriber" terms to describe the roles services assume when they participate in the publish-and-subscribe pattern. Within WS-Notification, however, these terms have more distinct definitions.
The term publisher represents the part of the solution that responds to situations and is responsible for generating notification messages. However, a publisher is not necessarily required to distribute these messages. Distribution of notification messages is the task of the notification producer. This service keeps track of subscriptions and corresponds directly with subscribers. It ensures that notification messages are organized by topic and delivered accordingly.
Note that:
- A publisher may or may not be a Web service, whereas the notification producer is always a Web service.
- A single Web service can assume both publisher and notification producer roles.
- The notification producer is considered the service provider.
Notification consumers and subscribers
A subscriber is the part of the application that submits the subscribe request message to the notification producer. This means that the subscriber is not necessarily the recipient of the notification messages transmitted by the notification producer. The recipient is the notification consumer, the service to which the notification messages are delivered (Figure 7.38).
Figure 7.38. A basic notification architecture.
Note that:
- A subscriber does not need to exist as a Web service, but the notification consumer is a Web service.
- Both the subscriber and notification consumer roles can be assumed by a single Web service.
- The subscriber is considered the service requestor.
Notification broker, publisher registration manager, and subscription manager
To alleviate the need for direct contact between the two groups of services we described in the previous two sections, a set of supplementary services is available (Figure 7.39).
- The notification broker A Web service that acts on behalf of the publisher to perform the role of the notification producer. This isolates the publisher from any contact with subscribers. Note that when a notification broker receives notification messages from the publisher, it temporarily assumes the role of notification consumer.
- The publisher registration manager A Web service that provides an interface for subscribers to search through and locate items available for registration. This role may be assumed by the notification broker, or it may be implemented as a separate service to establish a further layer of abstraction.
- The subscription manager A Web service that allows notification producers to access and retrieve required subscriber information for a given notification message broadcast. This role also can be assumed by either the notification producer or a dedicated service.
Figure 7.39. A notification architecture including a middle tier.
7.7.4. The WS-Eventing specification
As its name implies, WS-Eventing addresses publish-and-subscribe requirements by focusing on an event-oriented messaging model. When an event related to one Web service occurs, any other services that have expressed interest in the event are subsequently notified. Following are brief explanations of the terms and concepts expressed by the WS-Eventing specification.
Event sources
The term "publisher" is never actually mentioned in the WS-Eventing specification. Instead, its role is assumed by a broader-scoped Web service, known as the event source. This part of the eventing architecture is responsible for both receiving subscription requests and for issuing corresponding notification messages that report information about occurred events.
Event sinks and subscribers
On the subscription end of the eventing model, separate Web services manage the processing of notification and subscription messages. An event sink is a service designed to consume (receive) notification messages from the event source. Subscribers are services capable of issuing various types of subscription requests.
Subscription managers
An event source, by default, assumes the responsibility of managing subscriptions and transmitting notifications. In high volume environments it may be desirable to split these roles into separate services. To alleviate the demands on the event source, intermediate services, known as subscription managers, optionally can be used to distribute publisher-side processing duties.
Notification messages and subscription end messages
When an event occurs, it is reported by the event source via the issuance of a notification message (also called an event message). These are standard SOAP messages that contain WS-Eventing-compliant headers to convey event details.
WS-Eventing allows for an expiry date to be attached to subscriptions. This requires that subscribers issue renewal requests for the subscription to continue (as discussed in the next section). If a subscription is left to expire, though, it is the event source that often is expected to send a special type of notification to the corresponding event sink, called a subscription end message.
Subscription messages and subscription filters
Subscribers issue subscription messages directly to the event source or to an intermediate subscription manager. Different types of subscription-related requests can be transmitted via subscription messages.
The following specific requests are supported:
- Subscribe Requests that a new subscription be created. (Note that this message also contains the filter details, as well as the endpoint destination to which a subscription end message is to be delivered. Filters are described shortly.)
- Unsubscribe Requests that an existing subscription be canceled.
- Renew Requests that an existing subscription scheduled to expire be renewed.
- GetStatus Requests that the status of a subscription be retrieved.
For a subscriber to communicate that the event sink (on behalf of whom it is submitting the subscription request) is only interested in certain types of events, it can issue a subscription message containing a subscription filter. If the event source does not support filtering (or if it cannot accommodate the requested filter), the subscription request is denied.
The relationships between the subscription manager, event source, subscriber, and event sink are shown in Figure 7.40.
Figure 7.40. A basic eventing architecture.
7.7.5. WS-Notification and WS-Eventing
The fact that these two specifications currently provide overlapping feature sets is no indication that this will remain so in the future. It has been speculated that the reason these specifications were created separately was because the individual sponsors had diverging requirements. One of IBM's goals is to incorporate WS-Notification with its grid computing initiatives. Microsoft, on the other hand, is expected to utilize WS-Eventing within its system administration platform.
In an effort to continue promoting interoperability across proprietary platforms, IBM recently joined the WS-Eventing effort. It is entirely within the realm of possibilities that either specification will be modified to align with the otheror that the vendors involved will come to an agreement on how to establish a single notification extension that will meet their collective requirements. Language descriptions for these two specifications are therefore not currently provided in this book. (If you are interested in viewing the individual specifications, visit www.specifications.ws.)
7.7.6. Notification, eventing, and SOA
By implementing a messaging model capable of supporting traditional publish-and-subscribe functionality, corresponding legacy features now can be fully realized within service-oriented application environments (Figure 7.41). Moreover, the ability to weave a sophisticated notification system into service-oriented solutions can significantly broaden the applicability of this messaging model (as evidenced by the before mentioned plans to incorporate notification with grid computing).
Figure 7.41. Notification and eventing establishing standardized publish-and-subscribe models within SOA.
Service-oriented solutions can increase QoS characteristics by leveraging notification mechanisms to perform various types of event reporting. For example, performance and exception management related events can trigger notification broadcasts to potential service requestors (subscribers), informing them of a variety of conditions.
SUMMARY OF KEY POINTS |
---|
|