Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 5

Solving Integration Problems using Patterns account from another bank.

 Let’s assume that the remote function that deposits


Middleware – Recap money into a person’s account takes only the
person’s name and the Dollar amount as arguments.
 Middleware is any type of software that facilitates
 To perform this function, the front-end Web
 communication between two or more software
application has to be integrated with the back-end
systems
financial system that manages fund transfers.
o Can be simple communication connection
 The easiest way to connect the two systems is
between applications
through the TCP/IP protocol.
o Can be as sophisticated as information sharing
o Operating system or programming library
and logic execution
include a TCP/IP stack. TCP/IP is the
 mechanisms
ubiquitous communications protocol that
 Middleware is a technology that allows us to move transports data between the millions of
 information between multiple systems that may computers connected to the Internet and local
reside networks.
 within and outside an organization
Tight Coupling Example Solution
 Message-Oriented Middleware (MOM) is queuing
software  Code opens a socket connection to the address
www.boa.com and sends two data items (the
 that uses is messages as a mechanism to move
amount and the customer’s name) across the
 information from point to point
network.
o MOM uses the notion of messages to
 When we run this code it tells us: “7 bytes sent”.
communicate between applications,
o MOM resolves the problem of tight coupling
between applications
Tight Coupling
 A great example of tight coupling is a local method
invocation.
 Invoking a local method inside an application is
based on a lot of assumptions between the called
and the calling routine.
o Both methods have to run in the same process
(e.g. a virtual machine) and be written in the
same language (or at least use a common Tight Coupling Example Assumptions
intermediate language or byte code). This minimalist integration solution is fast and cheap,
o The calling method has to pass the exact but it results in a very brittle solution because the two
number of expected parameters, each using the participating parties make the following assumptions
correct type. about each other:
 The call is immediate, i.e. the called method starts
 Platform Technology – internal representations of
processing immediately after the calling method
numbers and objects
makes the call.
o 32 bit vs 64 bit internal representation
 Meanwhile, the calling method will only resume
o A system using 64 bits would be inclined to
processing when the called method completes
read 8 bytes off the network and would end up
(meaning the invocation is synchronous).
interpreting the whole message (including the
 The communication between the methods is
customer name) as a single number.
immediate and instantaneous, so neither the caller
 Location – hard-coded machine addresses
nor the called method have to worry about security
o Remote functions and machine location are
in the
hard-coded. Any change in anything, we would
 form of eavesdropping 3rd parties.
have to change code. If we use a lot of remote
 All these assumptions make it very easy to write
functions this could become very tedious.
well-structured applications that break functionality
into individual methods to be called by other
methods. o Time – all components have to be available at
Tight Coupling Example Problem the same time
 Establishing a TCP connection requires that
 Assume we are building an on-line banking system
both machines and the network are all
that allows customers to deposit money into their
available at the same time.
o Data Format – the list of parameters and their
types must match
 If we want to insert a third parameter, e.g. Message Construction
the name of the currency, we would have to
modify both sender and receiver to use the  When two applications wish to exchange a piece of
new data format. data, they do so by wrapping it in a message.
 Coupling is a measure of how many assumptions  Message intent
o Command Message: invoking a function or
parties make about each other when they communicate.
method on the receiver
Our simple solution requires the parties to make a lot of
o Document Message: enabling the sender to
assumptions. Therefore, this solution is tightly coupled.
transmit one of its data structures
o Event Message: notifying the receiver of a
Loosely Coupled Solution change in the sender.
 Instead, we can develop loosely coupled solution  Returning a response
by using a message-oriented middleware (MOM) o Request-Reply: The request is usually a
infrastructure Command Message, and the reply is a
 MOM mechanisms provide services such as Document Message containing a result value
o a common data format and transformers or an exception.
 Removes platform and data format o Return Address: The requestor specifies what
dependencies as the sender no longer has to channel to use to transmit the reply.
depend on the receiver's internal data o Correlation Identifier: Responder specifies
format which request this reply corresponds to.
o queuing channels  Huge amounts of data
 Removes location and time dependencies o Message Sequence: break the data into more
as we do not have to pay attention to manageable chunks and send them as a
computer’s identity & location or whether sequence of messages, so that the receiver can
the other computer is ready to accept reconstruct the original data structure.
requests or not.  Slow messages
 Removing these dependencies between the systems o Message Expiration: the sender can specify an
makes the overall solution more tolerant to change, expiration date. If the messaging system
the key benefit of loose coupling. cannot deliver a message by its expiration, it
should discard the message. If a receiver gets a
message after its expiration, it should discard
the message.
Things that make up Middleware: Channel
 Data needs to be transported, usually across a
network.
 We need a communications channel that can move
information from one application to the other. This
Things that make up Middleware channel could be a series of TCP/IP connections, a
 Middleware – the things that sit between shared file, or a shared database.
applications. o A channel is a logical address that both sender
 In order to connect two systems via an integration and receiver can agree on the same channel
solution, a number of things have to happen. without being aware of each other’s identity.
 Applications want to exchange data – Messages  The application selects a particular channel to send
o Message: a snippet of data that has an agreed- the data knowing that the receiver will be one that
upon meaning to both applications that are to is looking for that sort of data on that channel.
be integrated.
o This piece of data can be very small, such as
the phone number of a single customer that has
changed, or very large, such as the complete
list of all customers and their associated
addresses. Messaging Channels
Point-to-Point Channel: To send the data to a single
application (1-to-1 interaction) common format
Publish-Subscribe Channel: When you send a piece
of data this way, the channel effectively copies the data Things that make up Middleware: Routing
for each of the receivers (One to many interaction)  Middleware needs to take care of sending messages
Datatype Channel: all of the data on a channel has to to multiple systems
be of the same type (many to one interaction) o As the number of systems increases it becomes
Invalid Message Channel: When receiver receives a very tedious and requires the sending system
message that doesn’t meet these expectations to have knowledge about all other systems.
Dead Letter Channel: for messages which are o For example, if the customer address changes
successfully sent but ultimately cannot be successfully in the customer care system we could make
delivered. that system responsible for sending the data to
Guaranteed Delivery: makes channels persistent so all other systems that store copies of the
that their messages are stored on disk customer address.
Channel Adapter: can be used to connect a channel o We could expect each application to specify
(or set of channels) to the application without having to the target system(s) for the data it is sending
modify the application over the channel.
Messaging Bridge: connecting two message systems,
effectively connecting them into one composite
messaging system.
Message Bus: a backbone providing access to all of the
enterprise’s various and ever-changing applications and Message Routing
functionality.

Things that make up Middleware Translation


 Middleware needs to provide some mechanism to
convert one application’s data format in the other’s.
o Internal data format of an application can often
not be changed
o For example, one data format may store the
customer name in two fields, called
FIRST_NAME and LAST_NAME, while the
other system may use a single field called
Customer_Name.
Things that make up Middleware: System
management
 Integration solutions can quickly become complex
Message Transformation because they deal with multiple applications, data
formats, channels, routing and transformation.
Envelope Wrapper: wrap message payload data into
o All these elements may be spread across
an envelope that is compliant with the requirements of
the messaging infrastructure. multiple operating platforms and geographic
locations.
Content Enricher: when the target system requires
 In order to have any idea what is going on inside
data fields that the originating system cannot supply. It
the system we need a systems management
has the ability to look up missing information or
function.
compute it from the available data.
o This subsystem monitors the flow of data,
Content Filter: removes unwanted data from a
makes sure that all applications and
message.
components are available and reports error
Claim Check: removes data from a message but stores conditions to a central location.
it for later retrieval.
Normalizer: translates messages arriving in many
different formats into a common format.
Canonical Data Model: Design an independent data
model from any specific application. Require each
application to produce and consume messages in this
wants to receive a message.
Event-Driven Consumer: automatically handles
messages as they’re delivered on the channel.
Competing Consumers: Create multiple consumers on
a single channel so that multiple messages can be
processed concurrently.
System Management Message Dispatcher: consume messages from a
Control Bus: provides a single point of control to channel and distribute them to performers.
manage and monitor a distributed solution Selective Consumer: filters messages delivered to a
Detour: route messages through additional steps, such channel so that it only receives the ones that match its
as validation or logging – with ability to switch on or criteria.
off these additional steps Durable Subscriber: to make the messaging system
Wire Tap: inspect the contents of a message without save
affecting the primary message flow. messages published while the subscriber is
Message History: great aid to know where a specific disconnected.
message has been Idempotent Receiver: can safely receive the same
Message Store: can provide a complete account of message multiple times.
every message that traveled through the system Service Activator: connects the messages on the
Smart Proxy: track messages sent to request-reply channel to the service being accessed
services
Test Message: actively verifying that the running Widgets & Gadgets ‘R Us (WGRUS)
messaging system is functioning properly  Widgets & Gadgets ‘R Us (WGRUS) an on-line
Channel Purger: remove all remaining messages from retailer that buys widgets and gadgets from
a channel so that the components under test do not manufacturers and resells them to customers.
receive 'leftover' messages.

Things that make up Middleware: Endpoint


 Most packaged and legacy applications and many
custom applications are not prepared to participate
in an integration solution.
o As they were designed to perform specific
functionality with specific input/output
 We need a message endpoint to connect the system
explicitly to the integration solution.
o The endpoint can be a special piece of code or WGRUS IT Infrastructure
a Adapter provided by an integration software
 Four different channels to interact with customers.
vendor.
 Six internal information systems
 Design an integration solution to integrated these
systems

Messaging Endpoints
Messaging Gateway: a class than wraps messaging-
specific method calls and exposes domain-specific
methods to the application.
Messaging Mapper: creates a mapping logic between Requirements –
the messaging infrastructure and the domain objects. Business Processes
Transactional Client: make the client’s session with Take Orders
the messaging system transactional so that the client
 Customers can place orders via Web, phone or fax
can specify transaction boundaries.
Process Orders
Polling Consumer: explicitly makes a call when it
 Processing an order involves multiple steps,
including verifying inventory, shipping the goods
and invoicing the customer
Check Status Second Requirement
 Customers can check the order status Integration Solution – Set of Patterns for the
Change Address requirements:
 Customers can use a Web front-end to change their Message
billing and shipping address  Document Message
New Catalog Channel
 The suppliers update their catalog periodically.  Point-to-Point Channel
WGRUS needs to update its pricing and availability  Channel Adapter
based in the new catalogs.
Announcements Third Requirement
 Customers can subscribe to selective Integration Solution – Set of Patterns for the
announcements from WGRUS. requirements:
Testing and Monitoring Message
 The operations staff needs to be able to monitor all  Document Message
individual components and the message flow Channel
between them.
 Point-to-Point Channel
Channel Adapter
Take Orders and Process Orders
Fourth Requirement
Integration Solution – Set of Patterns for the
requirements:
Message
 Document Message
Channel
Requirements – Business Processes  Datatype Channel
 Identified Requirements:
- Interactions between Develop Integration
1 and 4 Solutions for Process Orders
2 and 5
3 and 6
4, 5, 6 and 7
 Identifying Integration
Requirements: Look for
change in Performers. Performers are application
that are supporting a specific activity within a
process
First Requirement
Integration Solution – Set of Patterns for the
requirements:
Message
 Document Message or Event Message
 Document message
would be best fit
Channel
 Point-to-Point
Channel
Endpoint
 Messaging Gateway

You might also like