java business integration - intranet...
TRANSCRIPT
Java Business Integration
• Enterprise Application Integration and B2B often require non-standard technology
• this causes lock-in!
• no single provider can give us all we need.
• JBI provides a standards SOA-based architecture for integration
• third-party components are plugged in
• interoperate in a predictable and reliable manner (message exchanges)
Interfaces defined through WSDL
Wednesday, May 22, 13
Meta Container• Service engines (SEs)
• JBI is a meta container
• A SE provides business logic and transformation services
• Binding components (BCs)
• Used to provide external connectivity
• Web services, JMS, etc.
• JBI also provides a management structure
• based on JMX
• install components
• manage a component’s lifecycle
• deploy service artifacts to components
Wednesday, May 22, 13
JBI Goals
• The establishment of a standard integration architecture for developers of service engines and binding components, known collectively as JBI components.
• The development of an abstract protocol-neutral Message Exchange and Normalized Message (NM)
• Provision of a standard mechanism for Message Exchanges to flow between JBI components
• Establishment of a standard for the packaging of JBI components, as well as for deployment of service artifacts to such components
• Definition of administrative and management hooks such that a diverse set of standard tools targeted at specific problem domains can emerge over time
Wednesday, May 22, 13
High Level Architecture
• JBI Messaging Infrastructure allows for decoupling• JBI offers APIs for installation, deployment, and management of components
Wednesday, May 22, 13
Normalized Messages
• WSDL has two levels: abstract service model vs concrete service model
• JBI uses the abstract model
• Components play either the provider or the consumer role
• Normalized messages are made of two parts:
• abstract XML message defined through WSDL
• message metadata (message context data)
• extra information used during processing by plugins and system components
Wednesday, May 22, 13
Normalized Message Router
• Provides One-Way, Reliable One-Way, Request-Response, and Request-Optional Response MEPs
• The qualities of service supplied by the NMR, in collaboration with the bindings and engines as needed, are:
• Best effort. Messages may be dropped, or delivered more than once.
• At least once. Messages may not be dropped, but duplicates may be delivered.
• Once and only once. Messages are guaranteed to be delivered only once.
Wednesday, May 22, 13
Normalized Message Exchange
1. BC Receives Request:
1. converts message to normalized form
2. creates a Message Exchange (container for the messages involved in the pattern)
3. sets metadata describing the desired service and operation
2. BC initiates the Message Exchange
3. NMR routes the message to the provider (SE/BC)
Wednesday, May 22, 13
Normalized Message Exchange
1. Consumer creates a normalized message
1. puts it into a Message Exchange
2. Consumer continues the Message Exchange
3. BC de-normalizes the message into a protocol and transport format and sends the message
Wednesday, May 22, 13
JBI vs. ESB
• JBI does NOT specify how to communicate among nodes• it only specifies the internal integration (JVM)• ESB has to specify inter-node communication facilities
• Open ESB does NOT provide communication transparency• ServiceMix uses JMS
Wednesday, May 22, 13
An Example
• Loan Request• BPEL Process
• LoanProcessor• JavaEE
• TransformReport• XSLT
• LoanReport• partner FTP
• LoanReportMailer• JMS (legacy email)
3 engine components: BPEL / JavaEE / XSLT3 binding components: WS / JMS / File
Wednesday, May 22, 13
Service unit vs service assembly
Service Unit: LoanRequestProcess/LoanRS WS/LoanProcessorEJB/ecc.Service Assembly: package containing all the service units
Wednesday, May 22, 13
Components in Open ESBApplication MashupAOSD
AspectsAspect SE
CommunicationsThese components provide different methods of communicating with other components of the Enterprise Service Bus.ADABAS NaturalCICS BCCORBA BCDCOM BCFile BCFTP BCHL7 BCHTTP BCSIP BCUDDI BCXMPP BC
Data ConversionTranslating different data formats among systems with varying requirements.ETL SEXSLT SE
Data Extraction and TransformationETL SESQL SE
Data IntegrationETL SEData Mashup
Database ConnectionComponents that allow connection and inspection of databases.InformixIMS BCJDBC BCOracleSAPSybase
Event ProcessingIEP SE
Java EESQL SE
Orchestration and CollaborationBPEL SE
ScriptingScripting SE
Work List ManagerWLM SE
Wednesday, May 22, 13
Apache ServiceMix• Flexible, open source integration container that unifies:
• ActiveMQ - message broker (JMS) - reliable messaging
• Camel - rule-based routing on the NMR
• Drools - rule engine
• CXF - web service stack (SOAP/REST)
• EIP - deployable routing patterns
• content-based, message-filter, pipeline, etc.
• ODE - business process execution
• Karaf - OSGi runtime
• EXEC - for executables and binaries
• FILE - Integration to the file system
• SAXON On FTP/HTTP/JMS/SOAP/MAIL/SNMP/XMPP
Wednesday, May 22, 13
Camel
• A CamelContext contains:
• components - endpoint factory
• endpoints - identified by URIs
• Internal Components:
• AMPQ, Atom, Aws, Bean, Cxf, Ejb, Exec, File, Ftp, GHttp, Gmail, Http, Irc, Javaspace, Jbi, Jdbc, Jetty, Jms, Jmx, Jpa, Ldap, Nagios, Rmi, Rss, Servlet, Sftp, Spring, Tcp, Udp, Xmpp, Xquery, Xslt
• External Components:
• ActiveMQ, Esper, Hibernate
• Camel implements Enterprise Integration Patterns
Wednesday, May 22, 13
ServiceMix Integration Example
<?xml version="1.0" encoding="UTF-8"?><blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation=" http://www.osgi.org/xmlns/blueprint/v1.0.0 http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd">
<camelContext xmlns="http://camel.apache.org/schema/blueprint"><route>
<from uri="file:camel/input"/><log message="Moving ${file:name} to the output directory"/><to uri="file:camel/output"/>
</route></camelContext>
</blueprint>
Move a file from one folder to another
Using Camel
Wednesday, May 22, 13
ServiceMix Integration Example
<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xsi:schemaLocation="http://www.osgi.org/xmlns/blueprint/v1.0.0http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd">
<camelContext xmlns="http://camel.apache.org/schema/blueprint"><route>
<from uri="file:camel/input"/><to uri="file:camel/output"/><setBody>
<simple>FileMovedEvent(file: ${file:name}, timestamp: ${date:now:hh:MM:ss.SSS})
</simple></setBody><to uri="activemq://events" />
</route></camelContext>
</blueprint>
Generates an event message and send it to ActiveMQ
Wednesday, May 22, 13
<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xsi:schemaLocation="http://www.osgi.org/xmlns/blueprint/v1.0.0http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd">
<camelContext xmlns="http://camel.apache.org/schema/blueprint"><route>
<from uri="activemq://events"/><to uri="log:events"/>
</route></camelContext>
</blueprint>
ServiceMix Integration Example
Receives the event message and routes it to the log
Wednesday, May 22, 13
24
• Mule is an open-source Enterprise Service Backbone (ESB)
Enterprise Service Backbone
Wednesday, May 22, 13
} Supports a variety of service topologies including ESB
} Highly Scalable; using SEDA event model
SOA Swiss Army Knife
Wednesday, May 22, 13
} Supports a variety of service topologies including ESB
} Highly Scalable; using SEDA event model
} Asynchronous, Synchronous and Request/Response Messaging
SOA Swiss Army Knife
Wednesday, May 22, 13
} Supports a variety of service topologies including ESB
} Highly Scalable; using SEDA event model
} Asynchronous, Synchronous and Request/Response Messaging
} J2EE Support: JBI, JMS, EJB, JCA, JTA, Servlet
SOA Swiss Army Knife
Wednesday, May 22, 13
} Supports a variety of service topologies including ESB
} Highly Scalable; using SEDA event model
} Asynchronous, Synchronous and Request/Response Messaging
} J2EE Support: JBI, JMS, EJB, JCA, JTA, Servlet
} Powerful event routing capabilities (based on EIP book)
SOA Swiss Army Knife
Wednesday, May 22, 13
} Supports a variety of service topologies including ESB
} Highly Scalable; using SEDA event model
} Asynchronous, Synchronous and Request/Response Messaging
} J2EE Support: JBI, JMS, EJB, JCA, JTA, Servlet
} Powerful event routing capabilities (based on EIP book)
} Breadth of connectivity; 60+ technologies
SOA Swiss Army Knife
Wednesday, May 22, 13
} Supports a variety of service topologies including ESB
} Highly Scalable; using SEDA event model
} Asynchronous, Synchronous and Request/Response Messaging
} J2EE Support: JBI, JMS, EJB, JCA, JTA, Servlet
} Powerful event routing capabilities (based on EIP book)
} Breadth of connectivity; 60+ technologies
} Transparent Distribution
SOA Swiss Army Knife
Wednesday, May 22, 13
} Supports a variety of service topologies including ESB
} Highly Scalable; using SEDA event model
} Asynchronous, Synchronous and Request/Response Messaging
} J2EE Support: JBI, JMS, EJB, JCA, JTA, Servlet
} Powerful event routing capabilities (based on EIP book)
} Breadth of connectivity; 60+ technologies
} Transparent Distribution
} Transactions; Local and Distributed (XA)
SOA Swiss Army Knife
Wednesday, May 22, 13
} Supports a variety of service topologies including ESB
} Highly Scalable; using SEDA event model
} Asynchronous, Synchronous and Request/Response Messaging
} J2EE Support: JBI, JMS, EJB, JCA, JTA, Servlet
} Powerful event routing capabilities (based on EIP book)
} Breadth of connectivity; 60+ technologies
} Transparent Distribution
} Transactions; Local and Distributed (XA)
} Fault tolerance; Exception management
SOA Swiss Army Knife
Wednesday, May 22, 13
} Supports a variety of service topologies including ESB
} Highly Scalable; using SEDA event model
} Asynchronous, Synchronous and Request/Response Messaging
} J2EE Support: JBI, JMS, EJB, JCA, JTA, Servlet
} Powerful event routing capabilities (based on EIP book)
} Breadth of connectivity; 60+ technologies
} Transparent Distribution
} Transactions; Local and Distributed (XA)
} Fault tolerance; Exception management
} Secure; Authentication/Authorization
SOA Swiss Army Knife
Wednesday, May 22, 13
No prescribed message format} XML, CSV, Binary, Streams, Record, Java Objects} Mix and match
Zero code intrusion} Mule does not impose an API on service objects} Objects are fully portable
Existing objects can be managed} POJOs, IoC Objects, EJB Session Beans, Remote Objects} REST / Web Services
Why do developers choose Mule?
Wednesday, May 22, 13
No prescribed message format} XML, CSV, Binary, Streams, Record, Java Objects} Mix and match
Zero code intrusion} Mule does not impose an API on service objects} Objects are fully portable
Existing objects can be managed} POJOs, IoC Objects, EJB Session Beans, Remote Objects} REST / Web Services
Why do developers choose Mule?
Wednesday, May 22, 13
No prescribed message format} XML, CSV, Binary, Streams, Record, Java Objects} Mix and match
Zero code intrusion} Mule does not impose an API on service objects} Objects are fully portable
Existing objects can be managed} POJOs, IoC Objects, EJB Session Beans, Remote Objects} REST / Web Services
Easy to test} Mule can be run easily from a JUnit test case} Framework provides a Test compatibility kit} Scales down as well as up
Why do developers choose Mule?
Wednesday, May 22, 13
27
• SEDA
• Staged Event-Driven Architecture
• Java NIO
• Java New Input/Output
Use of Advanced Technologies
Wednesday, May 22, 13
28
• SEDA decomposes a complex, event-driven software application into a set of stages connected by queues
• This design avoids the high overhead associated with thread-based concurrency models, and decouples event and thread scheduling from application logic
• By performing admission control on each event queue, the service can be well-conditioned to load, preventing resources from being overcommitted when demand exceeds service capacity
• SEDA employs dynamic control to automatically tune runtime parameters (such as the scheduling parameters of each stage) as well as to manage load
• Decomposing services into a set of stages also enables modularity and code reuse, as well as the development of debugging tools for complex event-driven applications
SEDA
Wednesday, May 22, 13
29
• NIO is a collection of Java programming language APIs that offer advanced features for intensive I/O operations
• NIO facilitates an implementations that can directly use the most efficient operations of the underlying platform
• NIO includes:
• Buffers for data of primitive types
• Character set encoders and decoders
• A pattern-matching facility based on Perl-style regular expressions (in package java.util.regex)
• Channels, a new primitive I/O abstraction
• A file interface that supports locks and memory mapping
• A multiplexed, non-blocking I/O facility for writing scalable servers
NIO
Wednesday, May 22, 13
• UMOs in Mule can be any object
• POJOs, EJBs, Remote Objects, WS/REST Services
• A service will perform a business function and may rely on other sources to obtain additional information
• Configured in Xml, or programmatically
• Mule Manages Threading, Pooling and resource management
• Managed via JMX at runtime
UMO
Wednesday, May 22, 13
• Used to connect components and external systems together
• Endpoints use a URI for Addressing
• Can have transformer, transaction, filter, security and meta-information associated
• Two types of URI
• scheme://[username][:password]@[host][:port]?[params]
• smtp://ross:pass@localhost:25
• scheme://[address]?[params]
• jms://my.queue?persistent=true
Endpoints
Wednesday, May 22, 13
• Control how events are sent and received
• Can model all routing patterns defined in the EIP Book
Routers
Wednesday, May 22, 13
• Control how events are sent and received
• Can model all routing patterns defined in the EIP Book
• Inbound Routers
• Idempotency
• Selective Consumers
• Re-sequencing
• Message aggregation
Routers
Wednesday, May 22, 13
• Control how events are sent and received
• Can model all routing patterns defined in the EIP Book
• Inbound Routers
• Idempotency
• Selective Consumers
• Re-sequencing
• Message aggregation
• Outbound Routers
• Message splitting / Chunking
• Content-based Routing
• Broadcasting
• Rules-based routing
• Load Balancing
Routers
Wednesday, May 22, 13
35
• A filter optionally filters incoming or outgoing messages that are coming into or going out from a connector.
• For example, the File Provider comes with a FilenameWildcardFilter that restricts which files are read by the connector based on file name patterns. For example only files with the .xml extension can be routed.
• Filters are used in conjunction with Routers.
Filter
Wednesday, May 22, 13
• Converts data from one format to another
• Can be chained together to form transformation pipelines
Transformers
Wednesday, May 22, 13
• Converts data from one format to another
• Can be chained together to form transformation pipelines
<jms:object-to-jms name="XmlToJms"/>
<custom-transformer name="CobolXmlToBusXml" class="com.myco.trans.CobolXmlToBusXml"/>
<endpoint address="jms://trades" transformers="CobolXmlToBusXml, XmlToJms"/>
Transformers
Wednesday, May 22, 13
37
• The nine stages of a mule event
• first 2 – inbound
• middle 4 – component
• last 2 – outbound
Endpoint(Message Receiver)
Endpoint(Message Dispatcher)
Inbound Router
Outbound Router
Inbound Transformer
Outbound Transformer
Interceptor
Service Invocation
Interceptor
Inbound
Component
Outbound
Mule Event Flow
Wednesday, May 22, 13
38
• Some event triggers a message flow
• A file being written into a folder
• A message arriving on a message queue
• A record in a database
• Data written to a socket
Endpoint(Message Dispatcher)
Inbound Router
Outbound Router
Inbound Transformer
Outbound Transformer
Interceptor
Service Invocation
Interceptor
Endpoint(Message Receiver)
Message Receiver Endpoint
Wednesday, May 22, 13
39
• The inbound router is the fist step in a message. Functions typically performed by an inbound router
• Filtering
• Remove duplicate messages
• Matching messages
• Aggregation (combining)
• Re-sequence data
• Forwarding
• See also
• IdempotentReceiver
• CorrolationAggregator
• CorrelationResequencerEndpoint
(Message Dispatcher)
Inbound Router
Outbound Router
Inbound Transformer
Outbound Transformer
Interceptor
Service Invocation
Interceptor
Endpoint(Message Receiver)
Inbound Router
Wednesday, May 22, 13
40
• Used to intercept message flow into your service component
• Used trigger monitor/events or interrupt the flow of the message
• Example: an authorization interceptor could ensure that the current request has the correct credentials to invoke the service.
Endpoint(Message Dispatcher)
Inbound Router
Outbound Router
Inbound Transformer
Outbound Transformer
Service Invocation
Interceptor
Endpoint(Message Receiver)
Interceptor
Interceptor
Wednesday, May 22, 13
41
• If the inbound data is not in the correct format for the service it must be transformed at this point
Endpoint(Message Receiver)
Endpoint(Message Dispatcher)
Inbound Router
Outbound Router
Outbound Transformer
Interceptor
Service Invocation
Interceptor
Inbound Transformer
Inbound Transformer
Wednesday, May 22, 13
42
• The actual service is performed
• In mule, this is generally a Java object
• Service invocation can also be a "pass through"
Endpoint(Message Receiver)
Endpoint(Message Dispatcher)
Inbound Router
Outbound Router
Outbound Transformer
Interceptor
Interceptor
Inbound Transformer
Service Invocation
Service Invocation
Wednesday, May 22, 13
43
• Dispatching the data to all the relevant endpoints
Endpoint(Message Receiver)
Endpoint(Message Dispatcher)
Inbound Router
Outbound Transformer
Interceptor
Interceptor
Inbound Transformer
Service Invocation
Outbound Router
Outbound Router
Wednesday, May 22, 13
44
Inbound Outbound Response
Idempotent Receiver Filtering Outbound Router Response Aggregator
Selective Consumer Recipient List
Aggregator Multicasting Router
Resequencer Chaining Router
Forwarding Consumer Message Splitter
Filtering List Message Splitter
Filtering Xml Message Splitter
Exception Based Router
Routers
Wednesday, May 22, 13
45
• Any transformations that needs to be done on the message after a service has been performed on the message can be executed before it is put into the endpoint
• See Also
• EnvelopeInterceptor
Endpoint(Message Receiver)
Endpoint(Message Dispatcher)
Inbound Router
Interceptor
Interceptor
Inbound Transformer
Service Invocation
Outbound Router
Outbound Transformer
Outbound Transformer
Wednesday, May 22, 13