Return to Home Page

The public review of the manuscript for "SOA Design Patterns" has concluded !
Thank you to all that participated. 234 reviews were received and over 30 new patterns have been contributed,
increasing the size of this book by over 50%. The second draft of the manuscript is currently in development.

About the Public Review
    History
    Podcasts (audio)
    Notification
    Submit Feedback
    Contribute a Proven Pattern
    Contribute a Candidate Pattern
    Acknowledgements
    Press Release

Introduction to SOA Types & Design Patterns
    The Architecture of
Service-Orientation
    Understanding SOA
Design Patterns

SOA Design Patterns
    Basic Service Inventory Design Pattern Language
    Architectural Design Patterns
    Basic Service Design
Pattern Language
    Service Design Patterns
    Common Compound
Design Patterns

Additional Resources
    View Entire TOC
    Symbol Legend
    Master Pattern List
(by category)
    Candidate Design Patterns
    Design Patterns Publications
    Download SOA Principles Poster (PDF)

About the Book



SOA Design Patterns
by Thomas Erl

For more information visit: www.soapatterns.com

Related Publications


Read the article "Introducing SOA Design Patterns" from the
June 2008 SOA World Magazine (High-Res PDF).

PLEASE NOTE

The content on this page is from the first draft of the manuscript for the upcoming book "SOA Design Patterns" by Thomas Erl. This version of the manuscript was authored in September, 2007. Since then, the manuscript has undergone significant content and structural changes as a result of an industry-wide review in which hundreds of SOA practitioners participated in addition to SOA vendors and experts from the design patterns community.

You are welcome to use the information on this page for research purposes, but you should assume that most of it will change in the final release of the "SOA Design Patterns" book.

Note also, that as a result of an industry-wide call for participation from December 2007 to February 2008, over 30 new design patterns have been contributed to this book. As they become finalized and are incorporated by the author, concise descriptions will be published on this site, and full descriptions with examples will be made available in the final, printed book.

Due to the volume of new content and changes, the release of the "SOA Design Patterns" book has been postponed to October, 2008. To learn more about the book, visit www.soapatterns.com. To be notified of updates to this site, use the notification form.

Chapter 6: Architectural Design Patterns

Home > Chapter 6 Overview > Event-Driven Messaging
Event-Driven Messaging

Event-Driven Messaging

How can service consumers be automatically notified of runtime service events?

Problem

Events that occur within the functional boundary encapsulated by a service may be of relevance to service consumers, but without resorting to inefficient polling-based interaction, the consumer has no way of learning about these events.

Solution

The consumer establishes itself as a subscriber of the service. The service, in turn, automatically issues notifications of relevant events to this and any of its subscribers.

Application

A messaging framework is implemented capable of supporting the publish-and-subscribe MEP and associated complex event processing and tracking.

Impacts

Event-driven messaging exchanges cannot easily be incorporated as part of cross-service transactions and publisher/subscriber availability issues can arise.

Principles

Standardized Service Contract, Service Loose Coupling, Service Autonomy

Architecture

Inventory, Service

Table 5.10 – Profile summary for the Event-Driven Messaging pattern.

Problem

Service consumers are typically required to initiate contact with service providers via the runtime invocation of the service program. In typical messaging environments, consumers can choose between one-way and request-response message exchange patterns (MEPs) but both need to originate from the consumer.

Events may occur within the service providerÕs functional boundary that are of interest to the service consumer. Following traditional MEPs, the consumer would need to continually poll the service provider in order to find out whether such an event had occurred (and to then retrieve the corresponding event details).

This model is inefficient because it leads to numerous unnecessary service invocations and data exchanges (Figure 6.x). It further introduces delays as to when the consumer receives the event information as it can only check at predetermined polling intervals.

Figure 6.47 – Service A (acting as a service consumer) polls Service B on an hourly basis for information about an event that Service A is interested in. Each polling cycle involves a synchronous, request-response message exchange. After the fourth hour, Service A learns that the event has occurred and receives the event information.

Solution

An event management program is introduced, allowing the service consumer to set itself up as a subscriber to events associated with a service (which assumes the role of publisher).There may be different types of events that the service provider makes available and consumers can choose which they would like to be subscribed to.

When such an event occurs, the service provider automatically sends the event details to the event management program, which then broadcasts the notification to all of the consumers registered as subscribers of the event.

Figure 6.48 – Service A requests that it be set up as a subscriber to the event it is interested in by interacting with an event manager. Once the event occurs, Service B forwards the details to the event manager which, in turn, notifies Service A (and all other subscribers) via a one-way, asynchronous data transfer. Note that in this case, Service A also receives the event information earlier because the event details can be transmitted as soon as theyÕre available.

Note: The solution proposed by this pattern is also known as an Event-Driven Architecture (EDA). It is comprised of a framework of sophisticated agents and programs built around the complex publish-and-subscribe message exchange pattern. The upcoming ESB Architecture for SOA title that will be released as part of the Prentice Hall Service-Oriented Computing Series from Thomas Erl will explore how event-drive messaging is supported via enterprise service bus platforms and will further provide more detailed, ESB-specific design patterns.

Application

An event-driven messaging framework is implemented as an extension to the service inventory. Runtime platforms, messaging middleware, and enterprise service bus products commonly provide the necessary infrastructure for message processing and tracing capabilities, along with system agents that provide complex event processing, filtering, and correlation.

Impacts

Event-Driven Messaging is based on asynchronous message exchanges that can occur sporadically, depending on whenever the service provider events actually occur. It therefore may not be possible to wrap these exchanges within runtime, cross-service transactions.

Furthermore, because notification broadcasts cannot be predicted, the consumer must always be available to receive the notification message transmissions. Also, messages are typically issued via the one-way MEP, which does not require an acknowledgement response from the consumer.

Both of the above listed drawbacks can raise serious reliability issues that can be addressed through the application of the Asynchronous Queuing and Reliable Messaging design patterns.

A common related impact is the difference in solution design. Developers need to become accustomed to designing service consumers and service providers to use an asynchronous messaging model that may seem ÒreversedÓ from traditional MEPs.

Relationships

The unique messaging model established by Event-Driven Messaging extends the base model provided by Service Messaging and is itself often extended via other specialized messaging patterns, such as Asynchronous Queuing and Reliable Messaging.

Figure 6.49 – The Event-Driven Messaging pattern provides distinct functionality that relies upon a combination of other messaging and agent-related patterns.

The publish-and-subscribe model that underlies the Event-Driven Messaging pattern provides advanced, asynchronous messaging functionality that can build upon the routing and messaging logic provided natively by ESB platforms (Figure 6.x).

Figure 6.50 – The Event-Driven Messaging pattern is considered an optional extension to the base Enterprise Service Bus compound pattern described in Chapter 9.

Case Study Example

Case study content is not available on this Web site.

Prev | Next
The Prentice Hall Service-Oriented Computing Series from Thomas Erl
Home    SOA Books    SOA Magazine    What is SOA?    SOA Principles    SOA Methodology    SOA Glossary Copyright © 2007-2008
SOA Systems Inc.