apache activemq, camel, cxf and servicemix overview
DESCRIPTION
TRANSCRIPT
Copyright © 2011 Progress So3ware Corpora6on and/or its subsidiaries or affiliates. All rights reserved. 1 A Progress So3ware Company
A Progress So3ware Company
Apache Ac6veMQ, Camel, CXF & ServiceMix Overview Open Source Integra6on and Messaging
Marcelo Jabali Sr. Solutions Consultant Sep., 2011
Copyright © 2011 Progress So3ware Corpora6on and/or its subsidiaries or affiliates. All rights reserved. 2 A Progress So3ware Company
Agenda
§ Apache Ac6veMQ § Apache Camel § Apache CXF § Apache ServiceMix § FuseSource Overview
Copyright © 2011 Progress So3ware Corpora6on and/or its subsidiaries or affiliates. All rights reserved. 3 A Progress So3ware Company
About Me
Marcelo Jabali FuseSource [email protected] marcelojabali.blogspot.com
mjabali
Copyright © 2011 Progress So3ware Corpora6on and/or its subsidiaries or affiliates. All rights reserved. 4 A Progress So3ware Company
Apache Ac6veMQ
§ A high performance, reliable messaging fabric, suppor6ng JMS, C, .Net, and other frameworks.
Clients connect to the broker using connectors with simple URIs
File & JDBC-based message stores supported.
… all based on a flexible Spring-based core.
Topics and queues created dynamically.
Network connectors control how the broker interacts with other brokers for discovery, replication, failover, clustering and store & forward.
Copyright © 2011 Progress So3ware Corpora6on and/or its subsidiaries or affiliates. All rights reserved. 5 A Progress So3ware Company
JMS Fundamentals
§ The JMS specifica6on defines a set of Java interfaces and seman6cs for inter-‐applica6on messaging
§ JMS defines two messaging models: • Point-to-point (PTP) • Publish and Subscribe (Pub/Sub)
Produce message
<<Application>> :JMSClient
Producer
<<Application>> :JMSClient
Consumer
Broker
Destination Consume message
Copyright © 2011 Progress So3ware Corpora6on and/or its subsidiaries or affiliates. All rights reserved. 6 A Progress So3ware Company
Point-‐to-‐Point Messaging Model
§ With the Point-to-Point messaging model: • Each message has only one and only consumer. • There are no timing dependencies; consumers do not have
to be connected at the time the message is sent.
§ PTP is ideal for processing business transactions.
Broker
Client A Queue Client B Produce message
Consume message
Copyright © 2011 Progress So3ware Corpora6on and/or its subsidiaries or affiliates. All rights reserved. 7 A Progress So3ware Company
Publish and Subscribe Messaging Model
§ With the Pub/Sub messaging model: • One message goes to zero-to-many consumers based on
the number of current subscribers • Subscribers with an active subscription at the time the broker
gets the message receive a copy of the message • Subscribers can be durable or non-durable
§ Pub/Sub is ideal for publishing business events.
Broker
Client A Topic
Client B
Client C
Client D
Produce message
Consume message
Copyright © 2011 Progress So3ware Corpora6on and/or its subsidiaries or affiliates. All rights reserved. 8 A Progress So3ware Company
JMS Classes and Interfaces
§ These are the classes and interfaces that you use to program the JMS client applica6on
Copyright © 2011 Progress So3ware Corpora6on and/or its subsidiaries or affiliates. All rights reserved. 9 A Progress So3ware Company
JMS Messages
§ Messages form the basic unit of work of a message provider
§ They are simple and flexible § Basic components of a message:
• Header (JMSDes6na6on, JMSDeliveryMode, JMSExpira6on, etc) • Proper6es (op6onal) – User-‐defined proper6es • Body (op6onal)
Copyright © 2011 Progress So3ware Corpora6on and/or its subsidiaries or affiliates. All rights reserved. 10 A Progress So3ware Company
Ac6veMQ Enhancements to JMS
§ Ac6veMQ Connec6on Factory segngs • disableTimeStampByDefault, copyMessageOnSend, useCompression,
objectMessageSerializa6onDefered, useAsyncSend, useRetroac6veConsumer
§ Des6na6ons are typically created on demand • They can also be created at the broker startup
§ Retroac6ve Consumers • Last Image, Fixed Count or Fixed Size
§ Des6na6on Policies • Dispatch policies – load balance consumers/producers
across destinations. • Recovery Policies – recover messages/subscriptions. • Pre-fetch policies – acknowledge messages sent to
consumers in batches.
Copyright © 2011 Progress So3ware Corpora6on and/or its subsidiaries or affiliates. All rights reserved. 11 A Progress So3ware Company
Ac6veMQ Enhancements to JMS (cont.)
§ Advisory Channels • Starting and stopping consumers and producers • Creating and destroying temporary destinations • Expiring messages on topics and queues • Sending messages from brokers to destinations with no
consumers • Starting and stopping connections
§ Exclusive Consumer Priority § Message Groups § Composite & Virtual Des6na6ons
• Forward, Route & High-‐Available Load-‐Balanced Durable Subscribers
Copyright © 2011 Progress So3ware Corpora6on and/or its subsidiaries or affiliates. All rights reserved. 12 A Progress So3ware Company
What are Network of Brokers?
§ In basic deployments, producers and consumers connect to the same broker to exchange messages
§ With broker networks, messages not consumed locally are forwarded broker-to-broker and dispatched to remote clients. • The message can travel through multiple brokers before it is
consumed • Each message is owned by a single broker at any point in time.
§ Broker networks allow you to scale your deployment by: • Accommodating many more clients, e.g. when the number of
sockets is limited by the OS • Increasing message throughput because messages are load-
balanced across all interested consumers. • Distributing consumers and producers geographically across a
WAN, firewall or other bridges
Copyright © 2011 Progress So3ware Corpora6on and/or its subsidiaries or affiliates. All rights reserved. 13 A Progress So3ware Company
Network of Brokers -‐ Example
§ Brokers A, B and C are part of a broker network § There is a producer to a queue on broker A and consumers
from the queue on brokers A and B § Messages sent to the queue are dispatched to consumers on
A and B; messages are not forwarded to C • If a consumer from the queue starts on C, messages will flow there as
well
A C
B
C
P
C
Copyright © 2011 Progress So3ware Corpora6on and/or its subsidiaries or affiliates. All rights reserved. 14 A Progress So3ware Company
Replica6on, Clustering & Failover
<<jvm>> samwise:ActiveMQ
Master state replicated to slave using network connector.
<<jvm>> frodo:ActiveMQ
<<jvm>> samwise:ActiveMQ
Brokers compete for file system or database lock.
<<jvm>> frodo:ActiveMQ
Broker replication Shared message store
Copyright © 2011 Progress So3ware Corpora6on and/or its subsidiaries or affiliates. All rights reserved. 15 A Progress So3ware Company
Master
Networks Of Master-‐Slave Pairs
§ A clustered, highly available approach
<<jvm>> merry:ActiveMQ
<<jvm>> frodo:ActiveMQ
<<jvm>> gandalf:ActiveMQ
<<jvm>> saruman:ActiveMQ
<<jvm>> samwise:ActiveMQ
<<jvm>> pip:ActiveMQ
Slave
Copyright © 2011 Progress So3ware Corpora6on and/or its subsidiaries or affiliates. All rights reserved. 16 A Progress So3ware Company
Apache Camel
§ Apache Camel is a powerful Open Source Integra6on Framework based on known Enterprise Integra6on Paqerns
http://enterpriseintegrationpatterns.com/
Copyright © 2011 Progress So3ware Corpora6on and/or its subsidiaries or affiliates. All rights reserved. 17 A Progress So3ware Company
Apache Camel -‐ Paqerns
§ 50+ Enterprise Integra6on Paqerns
http://camel.apache.org/eip
Copyright © 2011 Progress So3ware Corpora6on and/or its subsidiaries or affiliates. All rights reserved. 18 A Progress So3ware Company
Apache Camel – Components, Data Formats and Languages
§ 80 Components (ac6vemq, bean, cxf, file, 3p, hibernate, jdbc, iba6s, jms, jeqy, mina, neqy, 6mer, xslt, etc) • http://camel.apache.org/components.html
§ 19 Data Formats (csv, serializa6on, zip, hl7, soap, jaxb, etc) • http://camel.apache.org/data-format.html
§ 15 Expression Languages (EL, Simple, XQuery, Xpath, JavaScript, Ruby, Python, PHP, etc) • http://camel.apache.org/languages.html
Copyright © 2011 Progress So3ware Corpora6on and/or its subsidiaries or affiliates. All rights reserved. 19 A Progress So3ware Company
Apache Camel -‐ Architecture
The Camel context is an instance of the Camel runtime environment
A component is a plug-in endpoint factory; Camel provides a wide variety of components
An endpoint is a message source or sink
Container
Camel context
Components
Endpoints
Camel can be deployed in a wide variety of container types
Copyright © 2011 Progress So3ware Corpora6on and/or its subsidiaries or affiliates. All rights reserved. 20 A Progress So3ware Company
Apache Camel
§ Camel provides an embedded DSL (in Java, Spring or Scala) for implemen6ng enterprise integra6on paqerns • The DSL uses URIs to define endpoints which are combined to
generate integra6on flows
Copyright © 2011 Progress So3ware Corpora6on and/or its subsidiaries or affiliates. All rights reserved. 21 A Progress So3ware Company
Apache Camel
§ Camel Content-‐Based Router -‐ Spring DSL <camelContext> <route> <from uri="activemq:queue:NewOrders"/> <choice> <when> <xpath>/order/product = 'widget'</xpath> <to uri="activemq:Orders.Widgets"/> </when> <otherwise> <to uri="activemq:Orders.Gadgets"/> </otherwise> </choice> </route></camelContext>
Copyright © 2011 Progress So3ware Corpora6on and/or its subsidiaries or affiliates. All rights reserved. 22 A Progress So3ware Company
Apache Camel
§ Camel Content-‐Based Router -‐ Java DSL from("activemq:queue:NewOrders") .choice() .when().xpath("/order/product = 'widget'") .to("activemq:Orders.Widget") .otherwise() .to("activemq:Orders.Gadget");
Copyright © 2011 Progress So3ware Corpora6on and/or its subsidiaries or affiliates. All rights reserved. 23 A Progress So3ware Company
Typical Camel Route Development Process
§ Use a Maven archetype to generate an outline project
§ Edit the POM to include additional dependencies
§ Add your Java code into src/main/java, and/or Spring configuration to src/main/resources/META-INF/spring
§ Add instructions to the Maven Felix plugin, to assist in the generation of OSGi manifest information
§ Test using the Camel Maven plugin mvn camel:run
§ Deploy into the Apache ServiceMix OSGi container • Drop into deploy/ directory (pre-production testing) • Install a bundle/feature from a maven repository (production environment)
Copyright © 2011 Progress So3ware Corpora6on and/or its subsidiaries or affiliates. All rights reserved. 24 A Progress So3ware Company
Apache Camel -‐ Example
§ Goals • Pickup files from a directory • Make sure we only pickup 3 files per 30 seconds • Store into JMS queue • Listen on JMS queue • And upload file to FTP server
Copyright © 2011 Progress So3ware Corpora6on and/or its subsidiaries or affiliates. All rights reserved. 25 A Progress So3ware Company
Apache Camel – Example
§ Camel Route Spring XML DSL
<camelContext> <route> <from uri="file:camellos/inbox?move=.done"/> <throttle maximumRequestsPerPeriod="3" timePeriodMillis="30000”> <to uri="activemq:queue:camellos"/> </throttle> </route> <route> <from uri="activemq:queue:camellos"/> <to uri="ftp://admin:secret@localhost:3333"/> </route></camelContext>
Copyright © 2011 Progress So3ware Corpora6on and/or its subsidiaries or affiliates. All rights reserved. 26 A Progress So3ware Company
Apache CXF
§ Apache CXF is an open-source Java service framework
§ Full implementation of the JAX-WS 2.0 specification, radically simplifying the process of exposing existing Java code as a Web service or writing new Web services.
§ Provides design-time tools and runtime infrastructure that are technology-neutral.
§ Designed to work with variety of container servers, languages, and messaging systems
§ Originally named Celtix and later moved to Apache where it was merged with the Xfire project
Copyright © 2011 Progress So3ware Corpora6on and/or its subsidiaries or affiliates. All rights reserved. 27 A Progress So3ware Company
Building Applica6ons with CXF
§ CXF abstracts away the details of inter-process communication between services and consumers. • … allows developers to focus efforts on business logic rather
than integration logic.
§ CXF supports code-first and contract-first approaches: • Expose “plain old Java objects” (POJOs) as a services, or • Explicitly annotate Java classes, or • Start with a WSDL contract.
§ Use CXF to develop both client- and server-side components. • Deploy as standalone Java applications, or easily integrate into
a Spring-based application
Copyright © 2011 Progress So3ware Corpora6on and/or its subsidiaries or affiliates. All rights reserved. 28 A Progress So3ware Company
Apache CXF -‐ Architecture
§ CXF provides a layered communication stack to services and consumers
Copyright © 2011 Progress So3ware Corpora6on and/or its subsidiaries or affiliates. All rights reserved. 29 A Progress So3ware Company
Apache CXF -‐ Architecture
§ When a component sends a message to a service, it uses a Java API derived from the WSDL contract • The JAX-WS mapping is used. • The Java API is protocol neutral.
§ A CXF binding creates the message payload • Pure XML, SOAP, JSON, or some other message format.
§ Quality-of-service extensions can be added using message interceptors • CXF supports a number of Web Services QoS standards.
§ CXF then transmits the message using a transport. • CXF includes HTTP, JMS, and AMQP out-of-the-box. • You can write custom transports for CXF; for example: TCP, SMTP, FTP
Copyright © 2011 Progress So3ware Corpora6on and/or its subsidiaries or affiliates. All rights reserved. 30 A Progress So3ware Company
CXF Deployment Model
§ CXF can also be deployed in a number of different container technologies: • In a Servlet engine (e.g. Tomcat) • In a J2EE container (using bi-directional JCA) (e.g. JBOSS) • In a JBI (Java Business Integration) container (e.g. ServiceMix) • In an OSGi container (e.g. ServiceMix) • Stand-alone JVM (e.g. java –jar myapp.jar)
§ This flexible deployment approach allows you to deploy your CXF service-oriented components anywhere
Copyright © 2011 Progress So3ware Corpora6on and/or its subsidiaries or affiliates. All rights reserved. 31 A Progress So3ware Company
Apache ServiceMix
§ Full open source implementation of an Enterprise Service Bus • Based on OSGi technology (http://www.osgi.org)
§ Support for multiple component models • OSGi bundles • JBI artifacts • Servlets • Spring beans • Camel routes (http://camel.apache.org) • CXF web services and RESTful services (http://cxf.apache.org)
• Extensible to support additional component models, such as EJB
Copyright © 2011 Progress So3ware Corpora6on and/or its subsidiaries or affiliates. All rights reserved. 32 A Progress So3ware Company
Apache ServiceMix -‐ Architecture
§ ServiceMix employs a layered architecture based on OSGi • The core : A lightweight runtime named “Karaf”, which extends
OSGi with powerful features for handling and managing OSGI bundles
• The technology layer : A layer of component technologies that sits on top of the core to support your applications
Copyright © 2011 Progress So3ware Corpora6on and/or its subsidiaries or affiliates. All rights reserved. 33 A Progress So3ware Company
Apache ServiceMix – Core Layer Features
§ Hot deployment support for OSGi bundles
§ Dynamic configuration of services through the OSGi “ConfigurationAdmin” service
§ Dynamic logging back-end provided by Log4J supports different APIs (SLF4J, Java Utils, JCL, Avalon, Tomcat, OSGi)
§ Application provisioning through file-drop, Maven repository and remote download (http://)
§ Administration via an extensible shell console
§ Secure remote access via ssh
§ Security framework based on JAAS
Copyright © 2011 Progress So3ware Corpora6on and/or its subsidiaries or affiliates. All rights reserved. 34 A Progress So3ware Company
Apache ServiceMix – Technology Layer Features
§ Spring Framework • ServiceMix loads an OSGi bundle into its runtime, or generates an OSGi
bundle on the fly, and then instantiates the Spring application context
§ JMS Message Broker • ServiceMix deploys the Apache ActiveMQ broker (OSGi-ready)
§ JAX-WS/JAX-RS Web Services support • ServiceMix deploys the Apache CXF runtime (OSGi-ready)
§ Enterprise Integration Patterns (EIP) support • ServiceMix deploys the Apache Camel runtime (OSGi-ready)
§ Java Business Integration (JBI) support • ServiceMix provides a JBI 1.0 container, to support legacy code
implemented as service units / service assemblies and deployed using ServiceMix 3.x
§ Can be extended to support technologies such as SCA or EJB3
Copyright © 2011 Progress So3ware Corpora6on and/or its subsidiaries or affiliates. All rights reserved. 35 A Progress So3ware Company
Apache ServiceMix – Deployment Model
§ When you deploy a ServiceMix solution, you typically deploy the core (Karaf) plus one or more technology components
§ Examples: • To support EIPs : Karaf runtime + Camel feature • To support JAX-WS/JAX-RS solutions : Karaf runtime + CXF
feature • To support JMS solutions : Karaf runtime + ActiveMQ feature • To support JBI-based solutions : Karaf runtime + JBI feature
Copyright © 2011 Progress So3ware Corpora6on and/or its subsidiaries or affiliates. All rights reserved. 36 A Progress So3ware Company
FuseSource Corpora6on
The Leaders in Open Source Integra9on and Messaging
Produc9zed distribu9ons • Integrated • Tested • Tooling
Team behind the projects • Leaders at Apache • Product roadmaps • Code contribu9ons
Enterprise support • Subscrip9ons • Training • Consul9ng
Copyright © 2011 Progress So3ware Corpora6on and/or its subsidiaries or affiliates. All rights reserved. 37 A Progress So3ware Company
FuseSource Subscrip6on : Cer6fied Distribu6ons
Fuse ESB (ServiceMix), Fuse Message Broker (Ac9veMQ), Fuse Media9on Router (Camel), Fuse Services Framework (CXF)
• Tested – integrated tests on supported plasorms • Produc6zed distribu6ons – versioned, supported releases • Freely available with Apache license (can edit code and redistribute) • Enterprise-‐class distribu6ons of popular apache projects
Copyright © 2011 Progress So3ware Corpora6on and/or its subsidiaries or affiliates. All rights reserved. 38 A Progress So3ware Company
Forrester Wave Report Q2 2011: Fuse ESB is a “Leader”
§ FuseSource placed in “Leader” category in company with large, established vendors
§ One of few open source solu6ons considered for this report
§ Highest ranked open source solu6on
Copyright © 2011 Progress So3ware Corpora6on and/or its subsidiaries or affiliates. All rights reserved. 39 A Progress So3ware Company
FuseSource : Team that Wrote the Code
No one knows the code, or influences the projects at Apache more than FuseSource:
• Co-‐founders and PMC members of ServiceMix, Ac6veMQ, Camel, … • Over 25 ac6ve commiqers on 11 Apache projects
Jon Anstey Gary Tully Dejan Bosanac
Willem Jiang Gert Vanthienen
Guillaume Nodet Rob Davis
Claus Ibsen
Hiram Chirino James Strachan
Copyright © 2011 Progress So3ware Corpora6on and/or its subsidiaries or affiliates. All rights reserved. 40 A Progress So3ware Company
FuseSource Subscrip6on = Long Term Success
Support • Enterprise-‐class 24x7 coverage • Global organiza6on • Mission-‐cri6cal integra6on exper6se
• Updates and migra6on assistance
Influence • Product roadmaps • Planning processes • Conduit to Apache
Tools • Development • Opera6ons • Management • Performance • Documenta6on
Copyright © 2011 Progress So3ware Corpora6on and/or its subsidiaries or affiliates. All rights reserved. 41 A Progress So3ware Company
A Progress So3ware Company
Thanks!
No vendor lock-‐in Free to redistribute
Enterprise class