Introduction to Enterprise Integration Patterns
In this blog entry we will go through some of Enterprise Integration Patterns. These are known design patterns that aims to solve integration challenges. After reading this one would get a head start in designing integration solutions.
EIPs (in short) are known design patterns that provide solutions to issues/problems faced during application integration. The obvious question that comes to mind is, what are those issues/problems that we need to deal while integrating applications?
- Applications are heterogeneous in nature, they are developed using different languages, runs on different OS’es, understand different data formats.
- Applications undergo a lot of change, they are subjected to upgrades, and their API’s change over time.
- They need to exchange data over networks in a reliable and secure manner.
EIPs are classified in the following categories. Adjacent to these, notations that are used to refer these patterns is also specified.
Integration styles:
File Transfer
In this mode applications exchange information using files, files are shared at some common location.
Shared Database
Here applications use a common database schema.
Messaging
An entity mediates between applications that want to exchange data. It does the job of accepting messages from producers and then delivering to the consumers. Messaging helps to achieve loose coupling while integrating applications. It isolates the connecting applications from API changes/upgrades that happens over time.
RPC
In this an application exposes its functionality using interfaces, the caller needs to be aware of those and invokes them using stubs. Except RPC all the three mechanisms above are asynchronous in nature.
Next set of patterns talk about Messaging Systems:
Message
Structure of a message is well defined by the messaging system used. It usually contains header and body sections.
Message Channel
Channels are the mediums where messages are produced. They are the usual queue and topics.
Pipes and Filters
This pattern is useful when one needs to process messages before they are delivered to consumer applications.
Message Router
When the sender application does not know on which channel the receiver
is subscribed to. A router is used in between for delivering messages on the
correct channel. It has routing rules that decides where the messages
shall be delivered.
Message Translator
Translators are used to change the format of message. The sender application might send CSV data while the receiver application understands XML, in that case we need to have a translator before the receiving application that does the job of CSV to XML conversion.
Message Endpoint
Endpoint is a component that helps an application interact with
messaging systems.They have the protocol built in for communication with
the messaging systems.They are the message producers and the consumers.
Channel patterns: These patterns talk about attributes of messaging channels.
Peer 2 Peer
Channels that deliver a message to a single consumer. Example is a queue
Publish Subscribe
Channels that broadcast a message to all subscribing consumers. Topics are of pub-sub nature.
Dead Letter Channel
Channels used for moving messages which cannot be processed. Cases when the consumer can’t understand or messages get expired. This is important from the point of monitoring & management.
Messaging Bridge
These are the channel adapters that bridges different messaging systems. Consider a case when there are two enterprise systems, one uses Mircosoft’s MQ while the other uses IBM’s MQ server. There you need a bridge that can connect these.
Guaranteed delivery
Persistent channels are used to guarantee message delivery. In case the message system crashes, it would lose all messages present in memory. So usually channels are backed up a persistent store where all messages in the channel are stored.
Message Construction Patterns: These patterns are used to specify the intent of the messages. What should the receiver do after getting the message?
Command Message
These specify a method or a function that the receiver should invoke. Consider the case when XML is being used, the root node may specify the method name while the child elements specify the arguments for method invocation.
Document Message
When the sender passes data but it does not know what the receiver should do with it.
Event Message
Sender sends notification messages about changes happening on its end.
Here the receiver may choose to ignore or react to it.
Request Reply
In this the sender expects a reply back. Message might be composed of two parts, one contains the request and other is populated by the receiver i.e. the response.
Correlation Identifier
If the responses are received asynchronously, an id used to correlate the
responses with its corresponding requests.
Routing Patterns
Content Based Routing
Messages are inspected for determining the correct channel. Where XML is used, rules are written in XPath.
Message Filter
When a receiver is only interested in messages having certain properties, then it needs to apply a filter. This capability is generally comes in built with messaging systems.
Splitter
In case when messages arrive in a batch. A splitter is required to break the message into parts that can be processed individually.
Aggregator
An aggregator does the opposite job of a splitter. It correlates and combines similar messages.
Transformation Patterns
Content Enricher
An enricher does the job of adding extra information to a message.
This is required in case all the data to process the message is not present.
Content Filter
The Content Filter does the opposite it removes unwanted data from a message.
Normalizer
A normalizer does the job of converting messages arriving in different
formats to a common format. Your application needs the ability to accept
data in JSON, XML, CSV etc but the processing logic only understands XML, in that case you need a normalizer.
Endpoint patterns
Transaction Client
A transaction client helps in coordinating with external transaction services.
Message Dispatcher
Message dispatcher is a pattern where the receiver dispatches the arriving messages to workers. The workers have the job of processing the message.
Event Driven Consumer
In this the receiver registers an action on the messaging system;
on receiving a message the messaging systems calls that action.
System Management Patterns: These specify ways to monitor and manage systems efficiently.
Detour
As the name specifies, the path of the message is changed for doing activities such as validation, logging etc. This extra processing is control based, which can be turned off for performance reasons.
Wire Tap
Here the message is copied to a channel and is later retrieved for inspection or analysis.
Message Store
As the message is passed on from the receiver to the processing unit, the whole message or parts of it (some properties from header or message body) are stored in a central location.
To dive in more details check eaipatterns.com which has elaborated these patterns in-depth. In coming blog entries we will also look into Apache Camel that provides implementation to many of these patterns.
Reference: Introduction to Enterprise Integration Patterns from our JCG partner Abhishek Jain at the NS.Infra blog.
Thanks for the article. This is a great summary of EIP! ;)