Enterprise Integration
Patterns
Pavlo Petrenko
Seminar Web Engineering for Master Students Distributed and Self-organizing Systems Group
Computer Science Department 10 December 2012
EAI: Introduction
• What were initial problems?• Applications rarely live in isolation
• Creating a single, big application to run a complete
business is next to impossible
• Spreading business functions across multiple
applications provides the business with the flexibility to select the “best” packages for particular purposes
• Integrated Applications are independent programs that can each run by themselves, yet that function by coordinating with each other in a loosely coupled way.
• EAI is the unrestricted sharing of data and business
processes among any connected applications and data sources in the enterprise.
• Why does the area of EAI exist at all? - Heterogeneity of
enterprises
Introduction Messaging Conversation Conclusion
When to apply EAP and why
Introduction Messaging Conversation Conclusion○●○ ○○○○○○ ○○○○○○ ○
Information Portal Data Replication Shared Business Function
Service-Oriented Architecture Distributed Business Process Business-to-Business Integration
Enterprise Integration Styles
Introduction Messaging Conversation Conclusion○○● ○○○○○○ ○○○○○○ ○
Shared Database
File Transfer
Messaging Systems
• Channel: a communication medium, where one
application writes information to the channel and the other one reads that information from the channel.
• Message: a data record that the messaging system can transmit through a Message Channel.
• Message Router: a special filter, which consumes a
Message from one Message Channel and republishes it to a different Message Channel, depending on a set of conditions.
• Message Translator: a special filter between other filters or applications to translate one data format into another.
Introduction Messaging Conversation Conclusion
EAI Messaging Patterns
Normalizer
Introduction Messaging Conversation Conclusion
Messaging Channels & Construction
Patterns
Publish-Subscribe Channel: delivers a copy of a particular event to each receiver.
Return Address: indicates where to send the reply message.
Correlation Identifier: a unique identifier that indicates which request message this reply is for.
Introduction Messaging Conversation Conclusion
Message Routing & Transformation
Patterns
Aggregator: a stateful filter to collect and store individual messages until it receives a complete set of related
messages. Then, the Aggregator publishes a single message distilled from the individual messages.
Recipient List: inspects an incoming message, determines the list of desired recipients, and forwards the message to all channels associated with the recipients in the list.
Introduction Messaging Conversation Conclusion
○○○ ○○○●○○ ○○○○○○ ○
Content Enricher: a specialized transformer, used to to access an external data source in order to augment a message with missing information.
Normalizer: routes each message type through a custom Message Translator so that the resulting messages match a common format.
Loan Broker Problem
• When shopping for a loan, a customer usually calls several
banks to find the deal with the best possible interest rate.
• Each bank asks the customer for his or her social security
number, the amount of the loan, and the desired term (i.e., the number of months until the loan has to be paid off).
• Each bank then investigates the customer’s credit
background.
• Because contacting multiple banks with a loan quote
request is a tedious task, loan brokers offer this service to consumers.
Introduction Messaging Conversation Conclusion
Demo
Introduction Messaging Conversation Conclusion
Big Picture of EAP
Enterprise Integration
Messaging Conversation Processes Events
Introduction Messaging Conversation Conclusion
Conversation
Conversation = Series of Related Messages
Order Invoice Payment
Drinks
• Conversations can span seconds, hours, days
• Multiple conversation instances at the same time
• Messages belonging to one conversation are correlated
(typically through identifier)
Introduction Messaging Conversation Conclusion
Conversation Patterns
Chronological order of an interaction between services
• Discovery (Dynamic Discovery, Consult Directory, Referral)
• Establishing a Conversation (Three-way Handshake, Acquire
Token First, Rotate Tokens, Address Verification)
• Basic Conversations (Fire-and-Forget, Request-Response,
Request-Response with Retry, Polling, Subscribe-Notify, Quick Acknowledgment)
• Multi-Party Conversations (Proxy, Contingent Requests,
Reaching Agreement, Leader Election)
• Reaching Agreement (Receiver Cancels, Sender Cancels, Binding
Request, Binding Offer)
• Terminating Conversations (Lease, Renewal Reminder,
Heartbeat)
• Error Handling (Do Nothing, Retry, Compensating Action)
Introduction Messaging Conversation Conclusion
Establishing a Conversation
Three-way Handshake: the requestor initiates a
conversation, followed by an acknowledgment by the service provider, which is turn is followed by an
acknowledgment (Ack-Ack) from the initiator.
Acquire Token First: Have the initiator acquire a
reference token first. This token has to be included in subsequent requests.
Address Verification: The service provider sends a message with unique data to the consumer supplied address. The consumer has to pass the unique data back to service provider to complete the
authentication.
Introduction Messaging Conversation Conclusion
Basic Conversations
Request-Response with Retry: Have the consumer retry the request the request if it does not receive a response within a certain time interval.
Polling: Have the originating service poll, i.e., inquire whether the results are ready, multiple times if
necessary.
Quick Acknowledgment: Send an acknowledgment message quickly, followed by the actual results later.
Introduction Messaging Conversation Conclusion
Multi-Party Conversations
Proxy: a service that forwards messages between two services.
Contingent Requests: Have the initiator issue a request to a service. If it does not receive a
response within a certain timeframe, send a request to another service, and so on.
Reaching Agreement: Have a separate coordinator. The coordinator collects responses from each
participant, determines the outcome, and informs each participant of the outcome.
Introduction Messaging Conversation Conclusion
Conclusions
• Messaging is the most preferable integration style
nowadays.
• Messaging is loosely coupled, composable, elegant,
scalable, and asynchronous.
• 65 messaging patterns, 35 conversation patterns so far.
• Ample field for research: the rest of the EAI patterns
(processes, events, etc.) are still under development.
• Relevance to current trends in IT – Hybrid Clouds, Windows
Azure Service Bus EAI.
• Implementing some of EAI patterns instead of buying
proprietary solutions can save you a lot of money.
Introduction Messaging Conversation Conclusion
References
• Books
• Enterprise Integration Patterns: Designing, Building, and Deploying Messaging Solutions. Gregor Hohpe; Bobby Woolf; Addison-Wesley Professional 2003, ISBN-13: 978-0-321-20068-6
• Integration Patterns: Patterns & Practices. David Trowbridge, Ulrich Roxburgh et al. Microsoft Corporation 2004, ISBN 0-7356-1850-X
• Enterprise Application Integration. David S. Linthicum; Addison-Wesley Professional 1999, ISBN-13: 978-0-201-61583-8
• Articles
• Enterprise Integration Patterns. Gregor Hohpe; 2002.
• Conversation Patterns:Interactions between Loosely Coupled Services. Gregor Hohpe; 2007 http://eaipatterns.com.