Sie sind auf Seite 1von 6

The design patterns File Transfer

defined in this deck


are based on the book EE II

Enterprise Integration Application xx m


m Application
Application pp pp
Application
oo oo
Patterns (Addison- Apache Camel is a popular
AA rr
tt
Shared
rr
tt
BB

Wesley). Gregor Hohpe Data

and Bobby Woolf open source integration


documented their framework that makes Have each application produce
combined experience in it easy for developers to files that contain the information
the integration space and implement Enterprise the other applications must
created this notation, consume. Integrators take the
Integration Patterns. responsibility of transforming
which has since been files into different formats.
adopted as the standard http://camel.apache.org Produce the files at regular
for describing intervals according to the nature
messaging solutions of the business.
www.eaipatterns.com
Get the tool: fusesource.com/IDE Get the tool: fusesource.com/IDE Get the tool: fusesource.com/IDE

Shared Database Remote Procedure Messaging


Invocation
Application
Application Application
Application Application
Application
Application
Application Application
Application Application
Application
AA BB CC SS AA BB CC
kk
SS Function ee
Application
Application Application
Application
tt ll Event
uu ee
AA bb Result tt BB
oo Message Bus
Shared nn
Data

Develop each application as a Use Messaging to transfer


Integrate applications by having packets of data frequently,
large-scale object or component
them store their data in a single immediately, reliably, and
with encapsulated data. Provide
Shared Database, and define asynchronously, using
an interface to allow other
the schema of the database customizable formats.
applications to interact with the
to handle all the needs of the running application.
different applications.

Get the tool: fusesource.com/IDE Get the tool: fusesource.com/IDE Get the tool: fusesource.com/IDE

Message Channel Message Pipes and Filters

Message
Application
Application Application
Application Application
Application
Channel Pipe Pipe Pipe Pipe
AA BB CC Decrypt
Decrypt Authenticate
Authenticate De-Dupe
De-Dup

Incoming Filter Filter Filter Clean


Order Order
Event

Message Bus
Sender Messaging Receiver
Application System Application
Pipes and Filters describes a
Package the information into a fundamental architectural style
Message, a data record that the for messaging systems:
Connect the applications using
messaging system can transmit Individual processing steps
a Message Channel, where one
through a Message Channel. (filters) are chained together
application writes information to
through the messaging channels
the channel and the other one
(pipes).
reads that information from the
channel.

Get the tool: fusesource.com/IDE Get the tool: fusesource.com/IDE Get the tool: fusesource.com/IDE
Message Router Message Translator Message Endpoint

outQueue 1

inQueue
Translator
outQueue 2
Data Data
Message Message Message
Endpoint Message Channel Endpoint
Router
Sender Receiver
Insert a special filter, a Message Incoming Message Translated Message Application Application

Router, which consumes a The Message Endpoint


Message from one Message encapsulates the messaging
Channel and republishes it to Use a special filter, a Message system from the rest of the
a different Message Channel, Translator, between other filters application and customizes a
depending on a set of conditions. or applications to translate one general messaging API for a
data format into another. specific application and task.

Get the tool: fusesource.com/IDE Get the tool: fusesource.com/IDE Get the tool: fusesource.com/IDE

Point-to-Point Publish-Subscribe Dead Letter


Channel Channel Channel
Delivery Fails

Address Subscriber
Sender Order Order Order Point-to-Point Order Order Order Receiver
Changed
#3 #2 #1 Channel #3 #2 #1 Sender Message Channel Intended
Receiver

Reroute Delivery
A Point-to-Point Channel ensures Publisher Address
Changed
Address
Changed
Subscriber

that only one receiver consumes Dead


Message
Dead Letter
Channel
any given message. The channel
can have multiple receivers that Publish-Subscribe
Channel
Address
Changed
Subscriber
When a messaging system
can consume multiple messages determines that it cannot or
concurrently, but only one of Send the event on a Publish- should not deliver a message, it
them can successfully consume a Subscribe Channel, which may elect to move the message
particular message. delivers a copy of a particular to a Dead Letter Channel.
event to each receiver.

Get the tool: fusesource.com/IDE Get the tool: fusesource.com/IDE Get the tool: fusesource.com/IDE

Guaranteed Message Bus Command Message


Delivery
C C
Application C
Sender Receiver
Sender Command Receiver
Application Message
Disk Disk

Computer 1 Computer 2 C = getLastTradePrice('DIS');


Message Application
The messaging system uses local Bus
datastores to persist messages. A
A Message Bus is a combination
send operation cannot complete Use a Command Message to
of a Canonical Data Model, a
successfully until the message reliably invoke a procedure in
common command set, and
is stored in the sender’s local another application.
a messaging infrastructure
datastore. A message cannot be
to allow different systems to
deleted from one datastore until
communicate through a shared
it is forwarded and stored in the
set of interfaces.
next datastore.
Get the tool: fusesource.com/IDE Get the tool: fusesource.com/IDE Get the tool: fusesource.com/IDE
Document Message Event Message Request-Reply

E
D D
D Request Request
Observer Channel
Sender Document Receiver
Message
E E
E
D = aPurchaseOrder Reply Reply
Subject Event Observer Requestor Channel Replier
Message

A Document Message just passes E


Request-Reply has two
data and lets the receiver decide participants:
E = aPriceChangedEvent Observer
what, if anything, to do with the 1. Requestor sends a request
data. The data is a single unit message and waits for a reply
Use an Event Message for
of data, a single object or data message.
reliable, asynchronous
structure that may decompose 2. Replier receives the request
event notification between
into smaller units. message and responds with a
applications.
reply message.
Get the tool: fusesource.com/IDE Get the tool: fusesource.com/IDE Get the tool: fusesource.com/IDE

Return Address Correlation Content-Based


Reply
Channel 1
Reply
Channel 2
Identifier Router
Request
Channel
Requestor 1 Replier
Correlation Message ID
Widget
Requests Inventory
3 2 1
Reply 1 Gadget
Channel 1 Reply New Order
Requestor 2 Inventory
Router
Requests

Reply 1
Channel 2 Reply 1 2 3
The Content-Based Router
A message’s Return Address is Requestor Replies Replier
examines the message content
analogous to the reply-to field in Correlation ID
and routes the message onto a
an e-mail message. The reply-to
A requestor assigns each request different channel based on data
e-mail address is usually the
with a unique request ID. contained in the message.
same as the from address, but
Replier’s add the request ID to
the sender can set it to a different
the reply so that the requestor
address to receive replies in an
can correlate the reply with the
account other than the one used
request that generated it.
to send the original message.
Get the tool: fusesource.com/IDE Get the tool: fusesource.com/IDE Get the tool: fusesource.com/IDE

Message Filter Dynamic Router Recipient List


Dynamic Router Output Channel
AA Recipient Channel
Widget Gadget Widget Widget Widget
Quote Quote Quote Message Quote Quote
Message Router
AA
Input Channel Output Channel
Filter
BB
BB
Output Channel
C
C
The Message Filter is a Message Recipient List
C
C

Router with a single output Dynamic Rule Base

Control Channel
D
D

channel. If the content of an


incoming message matches The Dynamic Router routes
the criteria specified by the messages using a rule base that Define a channel for each
Message Filter, the message is is generated based on input from recipient. Then use a Recipient
routed to the output channel. If potential message recipients. List to inspect an incoming
the message content does not Communication between message, determine the list of
match the criteria, the message is recipients and the router are desired recipients, and forward
discarded. done over a special control the message to all channels
channel. associated with the recipients in
the list.

Get the tool: fusesource.com/IDE Get the tool: fusesource.com/IDE Get the tool: fusesource.com/IDE
Splitter Aggregator Resequencer

1
Inventory Inventory Inventory 2
3 2 1
Item 1 Item 2 Item 3 Aggregator 3
Order Order Order Inventory
New Order Splitter Item 1 Item 2 Item 3 Order Resequencer

Use a stateful filter, an


Use a Splitter to break out the The Resequencer can receive a
Aggregator, to collect and store
composite message into a series stream of messages that may not
individual messages until it
of individual messages, each arrive in order. It stores out-of-
receives a complete set of related
containing data related to one sequence messages in an internal
messages. Then, the Aggregator
item. buffer until a complete sequence
publishes a single message
distilled from the individual is obtained, and then publishes
messages. the messages to the output
channel in the proper sequence.

Get the tool: fusesource.com/IDE Get the tool: fusesource.com/IDE Get the tool: fusesource.com/IDE

Composed Message Scatter-Gather Routing Slip


Processor
Quote
Vendor
VendorAA Proc
Proc AA

Broadcast A
Vendor
VendorBB C
Proc
Proc BB
Quote Request
Attach Routing Slip
to Message
Vendor
VendorCC Proc
Proc C
C
Composite
New Order Message Validated
Route Message
According to Slip

Processor Order
“Best” Quote
Aggregator
Use a Composed Message Attach a Routing Slip to each
Processor to process a composite message, specifying the
Use a Scatter-Gather that
message. The Composed sequence of processing steps.
broadcasts a message to multiple
Message Processor splits Wrap each component with a
recipients and reaggregates the
the message up, routes the special message router that reads
submessages to the appropriate responses back into a single
the Routing Slip and routes the
destinations, and reaggregates message.
message to the next component
the responses back into a single in the list.
message.
Get the tool: fusesource.com/IDE Get the tool: fusesource.com/IDE Get the tool: fusesource.com/IDE

Content Enricher Content Filter Claim Check


Enricher
Check Luggage Data Enricher

Content Filter

Message Message Message


w/Claim Check
Basic Message Enriched Message w/Data w/Data

Message Message
Datastore

Resource
Store message data in a
Use a Content Filter to remove
The Content Enricher uses persistent store and pass a
unimportant data items from a
information inside the incoming Claim Check to subsequent
message, leaving only important
message (e.g., key fields) to components. These components
items.
retrieve data from an external can use the Claim Check to
source. After the Content retrieve the stored information.
Enricher retrieves the required
data from the resource, it
appends the data to the
message.

Get the tool: fusesource.com/IDE Get the tool: fusesource.com/IDE Get the tool: fusesource.com/IDE
Normalizer Messaging Gateway Messaging Mapper
Normalizer
Messaging
Mapper

Messaging Messaging Messaging


Different Message
Router
Common Format Gateway System Gateway Business Messaging
Formats
Object Infrastructure
Application Application
Translators

The Messaging Gateway


encapsulates messaging-specific The Messaging Mapper accesses
The Normalizer features one one or more domain objects and
Message Translator for each code (e.g., the code required to
send or receive a message) and converts them into a message
message format and routes as required by the messaging
the incoming message to the separates it from the rest of the
application code. channel. It also performs the
correct Message Translator via a opposite function, creating or
Message Router. updating domain objects based
on incoming messages.

Get the tool: fusesource.com/IDE Get the tool: fusesource.com/IDE Get the tool: fusesource.com/IDE

Transactional Client Polling Consumer Event-Driven


Consumer
transaction transaction

Sender Message Polling


Transactional Transactional
Producer
Message
Consumer Consumer
Sender Message Event-Driven
Sender Receiver Receiver Consumer

Receiver
A Polling Consumer is an object
Use a Transactional Client—make that an application uses to An Event-Driven Consumer
the client’s session with the receive messages by explicitly is an object that is invoked
messaging system transactional requesting them. When the by the messaging system
so that the client can specify application is ready for another when a message arrives on
transaction boundaries. message, it polls the consumer, the consumer’s channel. The
which in turn gets a message consumer passes the message
from the messaging system and to the application through a
returns it. callback in the application’s API.

Get the tool: fusesource.com/IDE Get the tool: fusesource.com/IDE Get the tool: fusesource.com/IDE

Competing Message Dispatcher Selective Consumer


Consumers
1
1
Consumer
Performer
Specifying Messages with Selective
Producer Selection Values Consumer
3 2 1 2
3 2 1 2 Receiver
Sender Messages Consumer
Sender Messages Performer
Message
Receiver
Dispatcher When a message arrives, a
3 3 Selective Consumer tests the
Consumer
Performer message’s selection value to
Receiver Receiver
see if the value meets the
Competing Consumers are consumer’s selection criteria. If
multiple consumers that are all When a Message Dispatcher so, the consumer receives the
created to receive messages from receives a message, it obtains a message and passes it to the
a single Point-to-Point Channel. performer and dispatches the application for processing.
When the channel delivers a message to the performer to
message, any of the consumers process it.
could potentially receive it.
Get the tool: fusesource.com/IDE Get the tool: fusesource.com/IDE Get the tool: fusesource.com/IDE
Durable Subscriber Idempotent Service Activator
Receiver
Network Failure
Durable Request
Service
Subscriber Sender Receiver
Message
Receiver
Ack.
Publisher
Message Reply Service
Ack. Activator

Publish-Subscribe Non-Durable Requestor Replier


Channel Subscriber Duplicate Message
Receiver A Service Activator handles all
Design a receiver to be an of the messaging details and
Use a Durable Subscriber to invokes the service like any other
Idempotent Receiver, one that
make the messaging system save client, such that the service
can safely receive the same
messages published while the doesn’t even know it’s being
message multiple times.
subscriber is disconnected. invoked through messaging.

Get the tool: fusesource.com/IDE Get the tool: fusesource.com/IDE Get the tool: fusesource.com/IDE

Detour Wire Tap Message Store

Wire Tap

Source
Source Destination
Destination Source Destination
Detour Source Destination

Control
Message Store

Construct a Detour with a


Context-Based Router controlled The Wire Tap (also known as tee)
via the Control Bus. In one state, is a fixed Recipient List with two Use a Message Store to capture
the router routes incoming output channels. It consumes information about each message
messages through additional messages off the input channel in a central location.
steps, while in the other it and publishes the unmodified
routes messages directly to the message to both output
destination channel. channels.

Get the tool: fusesource.com/IDE Get the tool: fusesource.com/IDE Get the tool: fusesource.com/IDE

FuseSource is the leader


in open source integration
and messaging, and
offers distributions of
Apache projects that
are productized and
supported by the people
who wrote the code.

Please visit
fusesource.com

Get the tool: fusesource.com/IDE

Das könnte Ihnen auch gefallen