Upload
others
View
8
Download
0
Embed Size (px)
Citation preview
Sun JavaTM Composite Applications Platform SuiteImplementing Selected EAI Patterns
Michael Czapski, Enterprise Architect, Sun MicrosystemsFrank Kieviet, Senior Staff Engineer, Sun Microsystems
TS-5301
2008 JavaOneSM Conference | java.sun.com/javaone | 2
Discover
Enterprise Application Integration (EAI) Patterns
and how they can be implemented in Java CAPS
to greatly accelerate the creation of EAI solutions
2008 JavaOneSM Conference | java.sun.com/javaone | 3
Assumptions about You
You have a requirement to integrate disparate applicationsYou have a notion of what design patterns areYou know design patterns can accelerate development
You want to / have to develop EAI solutionsYou want to use patterns to accelerate developmentYou want to know how to apply patterns in real solutionsYou are curious how Java CAPS assists EAI development
2008 JavaOneSM Conference | java.sun.com/javaone | 4
Agenda
Enterprise Application IntegrationEnterprise Integration PatternsBusiness ProblemImplementation with CAPS ExerciseSummary
2008 JavaOneSM Conference | java.sun.com/javaone | 5
Agenda
Enterprise Application IntegrationEnterprise Integration PatternsBusiness ProblemImplementation with CAPS ExerciseSummary
2008 JavaOneSM Conference | java.sun.com/javaone | 6
An example of EAI
Situation 10 years ago in a random enterprise• An ERP system generates purchase orders• The orders are printed out and mailed using USPS
ERPsystem
po.ps
2008 JavaOneSM Conference | java.sun.com/javaone | 7
Now• The same ERP system still generates purchase orders• There is now also a web ordering application for internal use• There is now a financial Order Approval System that is used to
guarantee that the company never commits more funds than it can.• There is now also a Financial Monitoring System• Purchase orders are now delivered electronically over the Internet
using a Transaction Delivery Network application
ERPsystem
po.csv
Webprocurement
systemorder.xml
FinancialMonitoring
system
OrderApprovalSystem
po.xml
TDNsystem
po.edi
po.xml
2008 JavaOneSM Conference | java.sun.com/javaone | 8
Observations
There are interactions between systems• These interactions are constantly changing• New interactions are added regularly• Number of interactions can grow rapidly (number of permutations)
When systems interact, they typically exchange messages• Business documents• Messages > enterprise dictionary / vocabulary
Message is a “structured octet string” – not an object.The structure is specific to the particular system that uses it
2008 JavaOneSM Conference | java.sun.com/javaone | 9
Enterprise Application Integration (EAI)
Comes to the rescue
2008 JavaOneSM Conference | java.sun.com/javaone | 10
Why is EAI software needed
The number of interactions grows exponentially• Externalizing interactions decouples applications
Externalized interactions require common services:• Application Connectivity• Message Routing• Data Transformation / Mapping• Data Enrichment• Process / Service Orchestration• Service Composition• Transactions:
• Two phase commit (short running transactions)• Compensating transactions (long running transactions)
• Expressions of business logic
2008 JavaOneSM Conference | java.sun.com/javaone | 11
EAI Software is used toFacilitate exchange of data between disparate applicationsSynchronise data between disparate applicationsProtect legacy investment for new developmentsDecouple applicationsSupport master data managementIntegrate processes across business unitsProvide foundation for new enterprise architecturesAvoid vendor lock-in
2008 JavaOneSM Conference | java.sun.com/javaone | 12
Enterprise Application Integration (EAI)Common Approaches to Application Integration• File Transfer• Shared Database• RPC• Messaging• Service Enablement
Common Application Integration Models• Point-to-Point• Hub-and-Spokes / Message Broker• (Message / Service) Bus
Common Technology Choices• Dominant CRM / ERP Vendor Tools• Dominant low-level non-EAI development technologies• Proprietary closed EAI Toolkits• Standards-compliant open EAI Toolkits
2008 JavaOneSM Conference | java.sun.com/javaone | 13
Agenda
Enterprise Application IntegrationEnterprise Integration PatternsBusiness ProblemImplementation with CAPS ExerciseSummary
2008 JavaOneSM Conference | java.sun.com/javaone | 14
Patterns
A proven way to capture experts’ knowledge in fields where there are no simple “one size fits all” answers• application architecture• object-oriented design• message-oriented integration.
Each pattern• addresses a specific design problem• discusses the considerations surrounding the problem• presents a solution that balances the various forces or drivers.
• http://www.enterpriseintegrationpatterns.com/
2008 JavaOneSM Conference | java.sun.com/javaone | 15
Enterprise Integration Patterns
Enterprise Integration Patterns: Designing, Building, and Deploying Messaging Solutions
By Gregor Hohpe, Bobby Woolf
Addison WesleyOctober 10, 2003ISBN : 0-321-20068-3
http://www.enterpriseintegrationpatterns.com/
2008 JavaOneSM Conference | java.sun.com/javaone | 16
EIP Pattern Groups
Messaging ChannelsMessage ConstructionMessage RoutingMessage TransformationMessaging EndpointsSystem Management
2008 JavaOneSM Conference | java.sun.com/javaone | 17
Messaging Channels
Point-to-Point ChannelPublish-Subscribe ChannelDatatype ChannelInvalid Message ChannelDead Letter ChannelGuaranteed DeliveryChannel AdapterMessaging BridgeMessage Bus
2008 JavaOneSM Conference | java.sun.com/javaone | 18
Messaging Channels
Point-to-Point ChannelPublish-Subscribe ChannelDatatype ChannelInvalid Message ChannelDead Letter ChannelGuaranteed DeliveryChannel AdapterMessaging BridgeMessage Bus
How can the caller be sure that exactly one receiver will receive the document or perform the call?
2008 JavaOneSM Conference | java.sun.com/javaone | 19
Messaging Channels
Point-to-Point ChannelPublish-Subscribe ChannelDatatype ChannelInvalid Message ChannelDead Letter ChannelGuaranteed DeliveryChannel AdapterMessaging BridgeMessage Bus
How can the sender broadcast an event to all interested receivers?
2008 JavaOneSM Conference | java.sun.com/javaone | 20
Messaging Channels
Point-to-Point ChannelPublish-Subscribe ChannelDatatype ChannelInvalid Message ChannelDead Letter ChannelGuaranteed DeliveryChannel AdapterMessaging BridgeMessage Bus
How can the application send a data item such that the receiver will know how to process it?
2008 JavaOneSM Conference | java.sun.com/javaone | 21
Messaging Channels
Point-to-Point ChannelPublish-Subscribe ChannelDatatype ChannelInvalid Message ChannelDead Letter ChannelGuaranteed DeliveryChannel AdapterMessaging BridgeMessage Bus
How can a messaging receiver gracefully handle receiving a message that makes no sense?
2008 JavaOneSM Conference | java.sun.com/javaone | 22
Messaging Channels
Point-to-Point ChannelPublish-Subscribe ChannelDatatype ChannelInvalid Message ChannelDead Letter ChannelGuaranteed DeliveryChannel AdapterMessaging BridgeMessage Bus
What will the messaging system do with a message it cannot deliver?
2008 JavaOneSM Conference | java.sun.com/javaone | 23
Messaging Channels
Point-to-Point ChannelPublish-Subscribe ChannelDatatype ChannelInvalid Message ChannelDead Letter ChannelGuaranteed DeliveryChannel AdapterMessaging BridgeMessage Bus
2008 JavaOneSM Conference | java.sun.com/javaone | 24
MessagingChannels
Point-to-Point ChannelPublish-Subscribe ChannelDatatype ChannelInvalid Message ChannelDead Letter ChannelGuaranteed DeliveryChannel AdapterMessaging BridgeMessage Bus
MessageConstruction
Command MessageDocument MessageEvent MessageRequest-ReplyReturn AddressCorrelation IdentifierMessage SequenceMessage ExpirationFormat Indicator
2008 JavaOneSM Conference | java.sun.com/javaone | 25
Content-Based RouterMessage FilterDynamic RouterRecipient ListSplitterAggregatorResequencerComposed Message ProcessorScatter-GatherRouting SlipProcess ManagerMessage Broker
MessageRouting
MessageTransformation
Envelope WrapperContent EnricherContent FilterClaim CheckNormalizerCanonical Data Model
2008 JavaOneSM Conference | java.sun.com/javaone | 26
Messaging GatewayMessaging MapperTransactional ClientPolling ConsumerEvent-Driven ConsumerCompeting ConsumersMessage DispatcherSelective ConsumerDurable SubscriberIdempotent ReceiverService Activator
MessagingEndpoints
SystemManagement
Control BusDetourWire TapMessage HistoryMessage StoreSmart ProxyTest MessageChannel Purger
2008 JavaOneSM Conference | java.sun.com/javaone | 27
Agenda
Enterprise Application IntegrationEnterprise Integration PatternsBusiness ProblemImplementation with CAPSExerciseSummary
2008 JavaOneSM Conference | java.sun.com/javaone | 28
Business Problem
2008 JavaOneSM Conference | java.sun.com/javaone | 29
Following an Order in the ERP System• A batch of orders in CSV format is created• File needs to be picked up, read and converted to a canonical
format• The CSV file does not contain all information necessary for
the canonical format so it needs to be enriched• All orders in the CSV file need to be approved by an approval
system• Each order needs to be sent out to the Internet Gateway
(TDN) in EDI format, or to a Fax gateway in PS format• A financial monitoring application needs to get a copy of the
order• An email needs to be sent to the submitter of the order when
the order goes out• The goods receiving department needs to be notified of the
order to prepare for arrival of goods
ERPsystem
po.csv
po.xml
read
convert
Approvalsystem
Monitoringsystem
EmailNotify
po.xml
po.txt
convert
TDNsystem
po.edi
convert
2008 JavaOneSM Conference | java.sun.com/javaone | 30
Business Solution is implemented in parts
Each major interaction is in its own solution• Allows for incremental development and testing
Solutions• ERP EAI• Web procurement EAI• Order approval EAI• Financial Monitoring EAI• TDN EAI• Fax gateway EAI• Email notification EAI
2008 JavaOneSM Conference | java.sun.com/javaone | 31
ERPsystem
po.csv po.xml
Approvalsystem
Monitoringsystem
Reserve.xml
ERP approval T
Finance
po.xml
TDNsystem
po.edi
TDN
Faxsystem
po.ps
Fax
po.txt
Solution in partspo.xml
po.xml
po.xml
po.xmlEAI applications or infrastructure
Existing systems
Messages
Webprocurement
order.xml
Web
Q
T
2008 JavaOneSM Conference | java.sun.com/javaone | 32
The solution in parts: ERP
ERP to order approval application• Reads the file• Converts it to Infoset, one for each PO
in the CSV file• Maps it to the canonical PO• Looks up missing data in a database• Invokes Order Approval Application
Patterns• Content Enricher• Canonical data model• Splitter• Message translator• Channel Adapter• Document Message
ERPsystem
po.csv po.xmlERP
2008 JavaOneSM Conference | java.sun.com/javaone | 33
Web procurement• Is a web application that lives on
a separate machine
Web procurement EAI application• Exposes a service through HTTP
or JMS• Uses a JMS queue for transaction isolation• Looks up missing data• Converts to canonical data format
Patterns• Content Enricher• Canonical data model• Message translator• Point-to-point channel• Channel Adapter• Document Message
po.xmlWeb
procurementorder.xml
Web
Q
2008 JavaOneSM Conference | java.sun.com/javaone | 34
Order approval system• Is a J2EE application that lives on a
separate machine• Interaction must be transactional;
interaction may take a long time (seconds to hours)• Communication using JMS
Store and Forward with Correlation
Order approval application• Exposes a service that takes the canonical purchase order• Calls the approval system through JMS• Waits for the response from JMS and correlates it• Publishes the approved order into the Purchase Order Topic
• Topic decouples multiple receivers• Rejected purchase orders go to a different topic
Patterns• Return Address, Splitter, Message Bus, Process Manager• Message Correlation, Correlation Identifier, Content-based Router• Guaranteed Delivery, Invalid Message Channel
po.xml
Approvalsystem
approval Tpo.xml
T
2008 JavaOneSM Conference | java.sun.com/javaone | 35
Finance monitoring system• Is a J2EE web service
Finance application• Receives Purchase Order from Topic• Converts into reserve.xml format• Invokes web service
Patterns• Durable Subscriber• Messaging Mapper• Request-Reply• Process Manager• Publish-Subscribe Channel• Message Bus
Monitoringsystem
Reserve.xml
Finance
po.xml
2008 JavaOneSM Conference | java.sun.com/javaone | 36
TDN system• Receives EDI messages over JMS
TDN application• Receives Purchase Order from Topic• Ignores orders that should not go out over this channel• Looks up additional data• Converts into EDI• Sends message to TDN over JMS
Patterns• Durable subscriber• Message Router• Message Translator• Channel Purger• Composed Message Processor• Content Enricher• Publish-Subscribe Channel
TDNsystem
po.edi
TDN
po.xml
2008 JavaOneSM Conference | java.sun.com/javaone | 37
Agenda
What is Enterprise Application IntegrationEnterprise Integration PatternsBusiness ProblemImplementation with CAPSExerciseSummary
2008 JavaOneSM Conference | java.sun.com/javaone | 38
Java CAPS / Open ESB
Java CAPS• Java Composite Application Platform Suite
Open ESB• the open source community around Java CAPS
Supports (amongst others)• Data format transformations / data mapping• Transactions
• Two phase commit (short running transactions)• Compensating transactions (long running transactions)
• Orchestration• Connectivity to numerous external systems• Expressions of business logic• Service Composition
2008 JavaOneSM Conference | java.sun.com/javaone | 39
Java CAPS facilities
Data format transformations / data mapping• Readers for many different formats (idoc, edi, ...)• Object wrappers for these formats• Mapping facilities in Java, XSLT, BPEL
Transactions• Two phase commit (short running transactions): through Java EE
transaction manager• Compensating transactions (long running transactions): through BPEL
engineOrchestration: through BPEL engineConnectivity to numerous external systems• 40+ JCA connectors, binding components
Expressions of business logic (in Java, BPEL)Service Composition (composite applications)
2008 JavaOneSM Conference | java.sun.com/javaone | 40
Java CAPS consists of…
Design time• An IDE in which you graphically lay out data flows and connections
between systems / services• Includes a graphical BPEL editor• Includes graphical mappers for both Java, BPEL and XSLT• Editor for wiring service units together
Runtime• A Java EE server / JBI runtime• JCA connectors / Binding Components• BPEL Engine
Management and monitoring• Browser based, graphical displays
2008 JavaOneSM Conference | java.sun.com/javaone | 41
Java CAPS Runtime
EE and JBI in GalssFish v2JBI (JSR-208) is a spec that enables interoperability of components between different JBI-compliant runtimesComponents • Service engines such as BPEL, XSLT, SQL, etc.• EE is also considered a service engine• Binding components such as JMS, File, HTTP, etc.
Communication between components…• … is message based• … is asynchronous• … can be mediated• … can be transactional• … can be very fast
2008 JavaOneSM Conference | java.sun.com/javaone | 42
The solution in parts: ERPERP
systempo.csv po.xmlERP
Reads and parses file
All these message exchanges are in-
memory
In-out message exchange; all others
are in-only
Database lookup
Data mapping
Canonicaldata
ERP specificdata
2008 JavaOneSM Conference | java.sun.com/javaone | 43
Order approval system
BPEL process
Request
Exposed service
Reply
OK Topic
Not OK Topic
BPEL process
po.xml
Approvalsystem
approval Tpo.xml
T
2008 JavaOneSM Conference | java.sun.com/javaone | 44
Patterns Implemented in Solution
Message Bus
Message Correlation
Message Router
Message Translator
Messaging Mapper
Point-to-point channel
Process Manager
Publish-Subscribe Channel
Request-Reply
Return Address
Splitter
22 Patterns
Canonical data model
Channel Adapter
Channel Purger
Composed Message Processor
Content Enricher
Content-based Router
Correlation Identifier
Document Message
Durable Subscriber
Guaranteed Delivery
Invalid Message Channel
2008 JavaOneSM Conference | java.sun.com/javaone | 45
Infrastructure-assisted patterns
JMS Message Server – 12 patterns• Point-to-point Channel• Guaranteed Delivery• Message Store• Messaging Bridge• Request/Reply• Event-Driven Consumer• Return Address• Channel Adapter• Message Bus• Message Broker• Message Dispatcher• Event Message
2008 JavaOneSM Conference | java.sun.com/javaone | 46
Infrastructure-assisted patterns
JBI NMR, BCs and Encoders – 14 patterns• Message Bus• Message Routing• Message Normalisation• Message Broker• Message Dispatcher• Control Bus• Canonical Data Model• Event-Driven Consumer• Request/Reply• Content Based Router• Datatype Channel• Document Message• Normalizer• Event Message
2008 JavaOneSM Conference | java.sun.com/javaone | 47
Infrastructure-assisted patterns
JBI BPEL SE and SUs, J2EE SE and SUs – 6 patterns• Message Correlation• Composed Message Processor• Message Mapper• Splitter• Content Enricher• Process Manager
NetBeans 6, GlassFish v2, Metro WS Infrastructure• Channel Adapter• Request/Reply
2008 JavaOneSM Conference | java.sun.com/javaone | 48
Agenda
Enterprise Application IntegrationEnterprise Integration PatternsBusiness ProblemImplementation with CAPSExerciseSummary
2008 JavaOneSM Conference | java.sun.com/javaone | 49
Let’s exercise the solution
2008 JavaOneSM Conference | java.sun.com/javaone | 50
Agenda
Enterprise Application IntegrationEnterprise Integration PatternsBusiness ProblemImplementation with CAPSExerciseSummary
2008 JavaOneSM Conference | java.sun.com/javaone | 51
Summary
EAI benefits from patterns-based development approachTools can assist in pattern-based developmentJava CAPS infrastructure directly supports most patterns
2008 JavaOneSM Conference | java.sun.com/javaone | 52
Java CAPS BasicsImplementing Common EAI Patterns By Michael Czapski Sebastian Krueger Brendan Marry Saurabh Sahai Peter Vaneris Andrew Walker
Prentice Hall, April, 2008ISBN : 0-13-713071-6
Our blogs• Frank - http://blogs.sun.com/fkieviet• Michael - http://blogs.sun.com/javacapsfieldtech/
Java CAPS EAI Patterns
2008 JavaOneSM Conference | java.sun.com/javaone | 53
2008 JavaOneSM Conference | java.sun.com/javaone | 54
Michael Czapski, Enterprise ArchitectFrank Kieviet, Senior Staff EngineerTS-5301