Document not found! Please try again

Implementing EAI Patterns using Java CAPS - Oracle

49 downloads 127 Views 573KB Size Report
Sun JavaTM Composite Applications Platform Suite. Implementing Selected EAI Patterns. Michael Czapski, Enterprise Architect, Sun Microsystems.
Sun JavaTM Composite Applications Platform Suite Implementing Selected EAI Patterns Michael Czapski, Enterprise Architect, Sun Microsystems Frank Kieviet, Senior Staff Engineer, Sun Microsystems TS-5301

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 |

2

Assumptions about You You have a requirement to integrate disparate applications You have a notion of what design patterns are You know design patterns can accelerate development

You want to / have to develop EAI solutions You want to use patterns to accelerate development You want to know how to apply patterns in real solutions You are curious how Java CAPS assists EAI development

2008 JavaOneSM Conference | java.sun.com/javaone |

3

Agenda Enterprise Application Integration Enterprise Integration Patterns Business Problem Implementation with CAPS Exercise Summary

2008 JavaOneSM Conference | java.sun.com/javaone |

4

Agenda Enterprise Application Integration Enterprise Integration Patterns Business Problem Implementation with CAPS Exercise Summary

2008 JavaOneSM Conference | java.sun.com/javaone |

5

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

ERP system

po.ps

2008 JavaOneSM Conference | java.sun.com/javaone |

6

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 Web procurement system

ERP system order .xml

po .xml

Order Approval System

po.edi po.csv

po .xml

TDN system

Financial Monitoring system 2008 JavaOneSM Conference | java.sun.com/javaone |

7

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 |

8

Enterprise Application Integration (EAI) Comes to the rescue

2008 JavaOneSM Conference | java.sun.com/javaone |

9

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 |

10

EAI Software is used to Facilitate exchange of data between disparate applications Synchronise data between disparate applications Protect legacy investment for new developments Decouple applications Support master data management Integrate processes across business units Provide foundation for new enterprise architectures Avoid vendor lock-in

2008 JavaOneSM Conference | java.sun.com/javaone |

11

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 |

12

Agenda Enterprise Application Integration Enterprise Integration Patterns Business Problem Implementation with CAPS Exercise Summary

2008 JavaOneSM Conference | java.sun.com/javaone |

13

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 |

14

Enterprise Integration Patterns Enterprise Integration Patterns: Designing, Building, and Deploying Messaging Solutions By Gregor Hohpe, Bobby Woolf

Addison Wesley October 10, 2003 ISBN : 0-321-20068-3 http://www.enterpriseintegrationpatterns.com/

2008 JavaOneSM Conference | java.sun.com/javaone |

15

EIP Pattern Groups Messaging Channels Message Construction Message Routing Message Transformation Messaging Endpoints System Management

2008 JavaOneSM Conference | java.sun.com/javaone |

16

Messaging Channels Point-to-Point Channel Publish-Subscribe Channel Datatype Channel Invalid Message Channel Dead Letter Channel Guaranteed Delivery Channel Adapter Messaging Bridge Message Bus 2008 JavaOneSM Conference | java.sun.com/javaone |

17

Messaging Channels Point-to-Point Channel Publish-Subscribe Channel Datatype Channel Invalid Message Channel Dead Letter Channel Guaranteed Delivery Channel Adapter Messaging Bridge Message 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 |

18

Messaging Channels Point-to-Point Channel Publish-Subscribe Channel Datatype Channel Invalid Message Channel Dead Letter Channel Guaranteed Delivery Channel Adapter Messaging Bridge Message Bus

How can the sender broadcast an event to all interested receivers?

2008 JavaOneSM Conference | java.sun.com/javaone |

19

Messaging Channels Point-to-Point Channel Publish-Subscribe Channel Datatype Channel Invalid Message Channel Dead Letter Channel Guaranteed Delivery Channel Adapter Messaging Bridge Message 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 |

20

Messaging Channels Point-to-Point Channel Publish-Subscribe Channel Datatype Channel Invalid Message Channel Dead Letter Channel Guaranteed Delivery Channel Adapter Messaging Bridge Message Bus

How can a messaging receiver gracefully handle receiving a message that makes no sense?

2008 JavaOneSM Conference | java.sun.com/javaone |

21

Messaging Channels Point-to-Point Channel Publish-Subscribe Channel Datatype Channel Invalid Message Channel Dead Letter Channel Guaranteed Delivery Channel Adapter Messaging Bridge Message Bus

What will the messaging system do with a message it cannot deliver?

2008 JavaOneSM Conference | java.sun.com/javaone |

22

Messaging Channels Point-to-Point Channel Publish-Subscribe Channel Datatype Channel Invalid Message Channel Dead Letter Channel Guaranteed Delivery Channel Adapter Messaging Bridge Message Bus 2008 JavaOneSM Conference | java.sun.com/javaone |

23

Messaging Channels Point-to-Point Channel Publish-Subscribe Channel Datatype Channel Invalid Message Channel Dead Letter Channel Guaranteed Delivery Channel Adapter Messaging Bridge Message Bus

Message Construction Command Message Document Message Event Message Request-Reply Return Address Correlation Identifier Message Sequence Message Expiration Format Indicator

2008 JavaOneSM Conference | java.sun.com/javaone |

24

Message Routing Content-Based Router Message Filter Dynamic Router Recipient List Splitter Aggregator Resequencer Composed Message Processor Scatter-Gather Routing Slip Process Manager Message Broker

Message Transformation Envelope Wrapper Content Enricher Content Filter Claim Check Normalizer Canonical Data Model

2008 JavaOneSM Conference | java.sun.com/javaone |

25

Messaging Endpoints Messaging Gateway Messaging Mapper Transactional Client Polling Consumer Event-Driven Consumer Competing Consumers Message Dispatcher Selective Consumer Durable Subscriber Idempotent Receiver Service Activator

System Management Control Bus Detour Wire Tap Message History Message Store Smart Proxy Test Message Channel Purger

2008 JavaOneSM Conference | java.sun.com/javaone |

26

Agenda Enterprise Application Integration Enterprise Integration Patterns Business Problem Implementation with CAPS Exercise Summary

2008 JavaOneSM Conference | java.sun.com/javaone |

27

Business Problem

2008 JavaOneSM Conference | java.sun.com/javaone |

28

ERP system po.csv

read convert po.xml

Approval system

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 • •

po.xml

Monitoring system convert po.txt

Email Notify convert

• • • •

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

po.edi

TDN system 2008 JavaOneSM Conference | java.sun.com/javaone |

29

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 |

30

Solution in parts ERP system po.csv

ERP

po.xml

Reserve .xml

po.xml

Finance

approval

po.xml

T

Monitoring system

po.edi

po.xml

TDN system

TDN

T Approval system

po.xml

Web procurement

Web

order .xml

po.ps

Fax system

Fax

Q EAI applications or infrastructure Existing systems

po.txt

po.xml

Email

Email

Messages 2008 JavaOneSM Conference | java.sun.com/javaone |

31

The solution in parts: ERP

ERP system po.csv

ERP

po.xml

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

2008 JavaOneSM Conference | java.sun.com/javaone |

32

Web procurement • Is a web application that lives on a separate machine

Web procurement EAI application • Exposes a service through HTTP

Web procurement

Web

order .xml

po.xml

Q

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 2008 JavaOneSM Conference | java.sun.com/javaone |

33

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

po.xml

approval

po.xml

T T

Approval system

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 2008 JavaOneSM Conference | java.sun.com/javaone |

34

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

Reserve .xml

po.xml

Finance

Monitoring system

2008 JavaOneSM Conference | java.sun.com/javaone |

35

po.xml TDN system • Receives EDI messages over JMS TDN 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

po.edi

TDN system

2008 JavaOneSM Conference | java.sun.com/javaone |

36

Agenda What is Enterprise Application Integration Enterprise Integration Patterns Business Problem Implementation with CAPS Exercise Summary

2008 JavaOneSM Conference | java.sun.com/javaone |

37

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 |

38

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 engine

Orchestration: through BPEL engine Connectivity 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 |

39

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 |

40

Java CAPS Runtime EE and JBI in GalssFish v2 JBI (JSR-208) is a spec that enables interoperability of components between different JBI-compliant runtimes Components • 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 |

41

ERP system

The solution in parts: ERP ERP specific data

po.csv

ERP

po.xml

In-out message exchange; all others are in-only

All these message exchanges are inmemory

Reads and parses file

Canonical data Data mapping Database lookup

2008 JavaOneSM Conference | java.sun.com/javaone |

42

Order approval system po.xml

approval

po.xml

T T

BPEL process Exposed service

Approval system

Request BPEL process OK Topic

Reply Not OK Topic 2008 JavaOneSM Conference | java.sun.com/javaone |

43

Patterns Implemented in Solution 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

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 2008 JavaOneSM Conference | java.sun.com/javaone |

44

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 |

45

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 |

46

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 |

47

Agenda Enterprise Application Integration Enterprise Integration Patterns Business Problem Implementation with CAPS Exercise Summary

2008 JavaOneSM Conference | java.sun.com/javaone |

48

Let’s exercise the solution

2008 JavaOneSM Conference | java.sun.com/javaone |

49

Agenda Enterprise Application Integration Enterprise Integration Patterns Business Problem Implementation with CAPS Exercise Summary

2008 JavaOneSM Conference | java.sun.com/javaone |

50

Summary EAI benefits from patterns-based development approach Tools can assist in pattern-based development Java CAPS infrastructure directly supports most patterns

2008 JavaOneSM Conference | java.sun.com/javaone |

51

Java CAPS EAI Patterns Java CAPS Basics Implementing Common EAI Patterns By Michael Czapski Sebastian Krueger Brendan Marry Saurabh Sahai Peter Vaneris Andrew Walker

Prentice Hall, April, 2008 ISBN : 0-13-713071-6

Our blogs • Frank - http://blogs.sun.com/fkieviet • Michael - http://blogs.sun.com/javacapsfieldtech/ 2008 JavaOneSM Conference | java.sun.com/javaone |

52

2008 JavaOneSM Conference | java.sun.com/javaone |

53

Michael Czapski, Enterprise Architect Frank Kieviet, Senior Staff Engineer TS-5301

2008 JavaOneSM Conference | java.sun.com/javaone |

54