ApacheCon EU 2009 Tales from the front line - ActiveMQ ServiceMix and CXF

1,348 views

Published on

My talk from ApacheCon EU 2009 on on-the-road experience of ActiveMQ, SMX and CXF.

0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
1,348
On SlideShare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
52
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

ApacheCon EU 2009 Tales from the front line - ActiveMQ ServiceMix and CXF

  1. 1. Tales from the front line: how ActiveMQ, ServiceMix, Camel and CXF are used to solve real world problems Adrian Trenaman Distinguished Consultant http://trenaman.blogspot.com
  2. 2. Ade's consultancy map... © 2009 Progress Software Corporation
  3. 3. Agenda  Brief introduction to Apache CXF, ServiceMix and ActiveMQ • From a functional and deployment perspective. •  Use cases and stories • Health-care: PDA-enable a government health system • Retail Pharmacy: warehouse / distribution management solution. • Document Storage: built on ActiveMQ • Telco Web Services: BSS systems •  This stuff works! • Highly available, clustered, flexible, extendible, ... • Focussed on enterprise integration & service enablement © 2009 Progress Software Corporation
  4. 4. ActiveMQ, ServiceMix, CXF & Camel © 2009 Progress Software Corporation
  5. 5. ActiveMQ  A high performance, reliable messaging fabric, supporting JMS, C, .Net, and other frameworks. © 2009 Progress Software Corporation
  6. 6. Networked brokers & distributed queues  Brokers use network connectors to share consumer information and make routing decisions using “store-and- forward” • JMS clients use failover URLs or auto-discovery to connect to a live broker. © 2009 Progress Software Corporation
  7. 7. ActiveMQ replication, clustering and failover © 2009 Progress Software Corporation
  8. 8. Networks of master-slave pairs  A highly available, clustered approach. <<jvm>> <<jvm>> <<jvm>> frodo:ActiveMQ gandalf:ActiveMQ merry:ActiveMQ Master Slave <<jvm>> <<jvm>> <<jvm>> samwise:ActiveMQ saruman:ActiveMQ pip:ActiveMQ © 2009 Progress Software Corporation
  9. 9. Apache ServiceMix – JBI-based integration  A standards-based framework for deploying integration solutions. • Solutions are deployed as service assemblies (SAs), containing service units (SUs) that initialize servce endpoints. © 2009 Progress Software Corporation
  10. 10. JBI component-based architecture <<jvm>> :SMX ServiceMix acts as a container for “components”, <<component>> <<component>> communicating with :FTP :EIP each other using the XML-based Normalized Message Router. NMR <<component>> <<component>> :JMS :SAXON Use well-known components like JMS, HTTP, CXF, Bean, FTP, FILE, or write your own. 0 © 2009 Progress Software Corporation
  11. 11. JBI component-based architecture <<jvm>> :SMX Build an application by configuring and wiring <<component>> <<component>> endpoints as SUs, :FTP :EIP combining them into SAs that can be deployed atomically. :Poller :Pipeline NMR <<component>> <<component>> :JMS :SAXON Endpoints are configured using xbean (Spring) configuration; :Producer :Transformer deployment artifacts are created using maven plugins. 1 © 2009 Progress Software Corporation
  12. 12. JBI packaging <<jar>> Each component is <<zip>> <<zip>> specialized using a SU. In ServiceMix, the jbi.xml xbean.xml jbi.xml xbean.xml endpoint(s) are defined in an xbean.xml file. Maven plugins are used to .class resources .class resources generate jbi.xml file ftp-input-su eip-su SUs can optionally contain support classes and <<zip>> <<zip>> resources such as WSDL & XSD jbi.xml xbean.xml jbi.xml xbean.xml SUs are bundled together into an SA to be deployed atomically. .class resources .class resources jms-output-su xslt-transformer-su 2 © 2009 Progress Software Corporation
  13. 13. Hidden gem: “message flows”  Internally, the NMR uses different <<jvm>> approaches (“flows”) to deliver :SMX messages between components :FilePoller • ST - straight through on the same thread NMR • SEDA - intermediary in memory queue • JMS - using ActiveMQ • JCA - using XA-transactional queues with ActiveMQ <<jvm>>  The flow is chosen dynamically at :SMX runtime NMR • ServiceMix chooses the flow according to the quality of service of the message exchange. :JMSProvider 3 © 2009 Progress Software Corporation
  14. 14. Apache ServiceMix 4.0 - OSGi  ServiceMix 4.0 provides a new OSGi-based core • OSGi provides a simpler deployment artifact - the bundle - with versioning, class-path isolation & service life-cycle. • JBI functionality is implemented as a plug-in 'feature'  Easily deploy CXF services, Camel routes, ActiveMQ, JBI components, Spring configuration, bundles, … 4 © 2009 Progress Software Corporation
  15. 15. ServiceMix4: OSGi-based integration 5 © 2009 Progress Software Corporation
  16. 16. FUSE Services Framework (Apache CXF)  Flexibly create & deploy code-first or WSDL-first Java web services. Choose the payload (XML, SOAP, JSON) or transport (HTTP, JMS) declaratively with no impact on code. Implement services using JAX-WS or JAX- :Consumer :MyImpl RS Invoice inv WSDL @WebService = new Invoice(); Class MyImpl implements Invoicing { XSD invoiceSvc.process(inv); public void process( Invoice inv) Separation of concerns { } } 6 © 2009 Progress Software Corporation
  17. 17. Cool things about FUSE Service Framework  Code RESTful services using JAX-RS  Generate client-side JavaScript code on the fly for browser- based WS clients: • http://localhost:9000/InvoicingService?js  Deploy anywhere: • J2EE: WebLogic, WebSphere, Tomcat, Jboss • OSGi: Servicemix 4 • JBI: ServiceMix 3 • SpringFramework • Lightweight FUSE Spring Container • Standalone: public static void main(…) { } 7 © 2009 Progress Software Corporation
  18. 18. Integration for Mobile Healthcare 8 © 2009 Progress Software Corporation
  19. 19.  Aim: expose patient care data from the national healthcare systems to health professionals using PDAs.  Key points: • Four month project. • Integration using SOAP/HTTP and the healthcare HL7 XML schema library.  Solution built using ServiceMix (Fuse ESB). • Architecture: SEDA based; use embedded transactional queues to achieve synchronous, synchronous reliable, and asynchronous reliable flows. • Standards: SOAP, JBI, HL7, XML, XSD, XSLT • Tools: JDK, Eclipse, Maven, Subversion, Fuse ESB, CXF  Methodology: agile methods, war room, stand-ups, XP metrics, all in the context of a highly formal project methodology 9 © 2009 Progress Software Corporation
  20. 20. Architecture  Integration bridge between national health-care system and mobile devices • Providing patient care data to medical professionals on PDA. Presentation Layer • Supporting synchronous, asynchronous and reliable asynchronous message Hot replica exchange patterns. <<linux>> <<linux>> :Frodo :Samwise {cpus=2} {cpus=2} HL7 Backbone 0 © 2009 Progress Software Corporation
  21. 21. Architecture notes: synchronous flow  Presentation layer makes a blocking call on the integration service, which in turn blocks as it accesses the back-end. • ... with some transformation to/from HL7 XSD using XSLT stylesheets. • Easy peasy, lemon squeezy. :ESB Presentation Layer 1 14 HTTP Consumer Fuse ESB Container 2 13 MSP Fault Wrapper 3 12 5 11 4 Routing Slip 10 Inbound 6 Outbound Transformer Transformer MSP > HL7 HL7 > MSP :BackEnd 9 Spine HTTP Provider 7 8 Spine 1 © 2009 Progress Software Corporation
  22. 22. Architecture notes: synchronous unreliable flow  Presentation layer makes a blocking call on the ESB • Which uses an 'asynch bridge' pattern to send a message to the back-end... • And correlate a subsequent message from the back-end as a the response. :ESB Presentation Layer 1 25 HTTP Consumer Fuse ESB Container 2 Content-Based If PickList is TRUE and Router 24 SearchType is algorithmic 3 If PickList is FALSE If PickList is TRUE and SearchType is alphanumeric 5 23 22 4 21 Inbound Transformer Algorithmic Inbound Transformer Alphanumeric Inbound Transformer Patient MSP > HL7 Transform MSP > HL7 Transform Adds ebXML, MIME Transformer HL7 > MSP HL7 > MSP HL7 > MSP 7 20 6 19 Algorithmic Alphanumeric Patients Routing Slip Outbound Routing Slip Outbound Inbound Routing Slip Outbound Inbound Transformer Inbound Transformer Transformer Strips 8 Transformer Strips Transformer Transformer Strips Adds ebXML Adds ebXML ebXML ebXML MSP > HL7 ebXML 16 Asynchronous Bridge Asynchronous Bridge Asynchronous Bridge 9 17 ACK ACK ACK 13 Async Error Async Error Async Error Handler Handler Handler :BackEnd ACK ACK ACK 10 ACK ACK ACK Spine HTTP Spine HTTP Spine HTTP Provider Provider Provider 11 15 Spine HTTP Spine HTTP Spine HTTP Consumer Consumer Consumer 18 ACK ACK ACK ACK ACK ACK 12 14 Spine Spine Spine Spine Spine Spine 2 © 2009 Progress Software Corporation
  23. 23. Architecture notes: synchronous unreliable flow (cont')  Unreliable? What do you mean, UNRELIABLE? •  The client is blocking for a response, so • If there's an error in the flow, then the client will receive an exception or timeout... • ... so they can retry. • ... so this means there's no need to make the flows persisted or transactional. • ... hence, the term 'unreliable' •  Use reliability when you need it. :ESB :BackEnd 3 © 2009 Progress Software Corporation
  24. 24. Architecture notes: asynchronous reliable flow  Presentation layer submits a request to the integration service. • Message is placed on persisted queue; ACK is returned. • Message read off queue, request is submitted to HL7 back-end. • Later a 'useless ACK' response is received from back-end and placed on a queue; this is logged for audit. Presentation Layer 1 ACK 6 MSP Receiver HTTP Consumer Fuse ESB Container 2 ACK 5 ACK Handler 3 ACK Spine Logger Logger Transformer :ESB 4 27 JMS Provider 26 29 Persistent Exchange Pipeline 28 Queue Terminator Spine Sender 7 25 JMS JMS Consumer Consumer ACK 18 Persistent Error Handler Queue 8 ACK Spine Receiver 10 17 22 9 JMS Provider Inbound Transformer MSP > HL7 ACK 12 21 11 ACK Handler 23 Inbound Transformer Routing Slip Adds ebXML 13 ACK ACK 16 :BackEnd HTTP Provider 14 20 HTTP Consumer 24 ACK ACK 15 19 Spine Spine 4 © 2009 Progress Software Corporation
  25. 25. Lessons learnt  Open source is geared for  ServiceMix is solid. partnership • Great performance in non- • Java/XML/Maven/Spring skills functional test: the 72 hour flat-line readily available. of joy. • We had some great externals on this project.  ServiceMix is not a silver bullet. • Some of those flows were tricky.  Agile can work well in a formal project environment  Community contact is good • Need a good project manager to • IRC, direct email act as a “spring”. • Problem analysis: Use the source, Luke. • Don’t get distracted by the dark side of the source. 5 © 2009 Progress Software Corporation
  26. 26. Retail Pharmacy 6 © 2009 Progress Software Corporation
  27. 27. ... actually, a warehouse scheduling problem  How to schedule trucks and payload to increase turnaround and save on penalties. •  Application manager at warehouse sketched his design using gregor-grams on Visio. • ... and discovered he could implement them using ServiceMix. •  End solution was declarative configuration of EIPs. • No code, just config. • Maven, xbean, ... 7 © 2009 Progress Software Corporation
  28. 28. The EIP solution 8 © 2009 Progress Software Corporation
  29. 29. Aside  We've seen Apache middleware adopted numerous times in retail sector. • No million-dollar budget. • Pragmatic, bottom-line approach. • Real results, real-time. 9 © 2009 Progress Software Corporation
  30. 30. Telco 0 © 2009 Progress Software Corporation
  31. 31. Web Services for BSS  Mobile operator with a growing suite of web services around customer care and provisioning. • CXF used for Web Services • Deployed in Tomcat • Load-balanced via Apache Proxy •  >50 services: • Needed more control over provisioning and better security. 1 © 2009 Progress Software Corporation
  32. 32. Proposed Architecture 2 © 2009 Progress Software Corporation
  33. 33. Another telco use-case  Implementation of Parlay-X • Allowing Telcos to provide services such as MMS, SMS, ALM to partners. – For example, how does my SMS vote for X-Factor get counted? • Integrates heavily with CORBA Parlay infrastructure – Makes use of CXF CORBA binding. •  Services deployed using OSGi framework. 3 © 2009 Progress Software Corporation
  34. 34. WSDL WSDL WSDL WSDL WSDLV Web Services SDP Artix technology used for CXF (Artix Distribution) service infrastructure, provisioning and management. Parlay X CORBA Services DB IONA Orbix™ Parlay OSA SS7, CAMEL, SIP, IMS Network Wired Mobile IP 4 © 2009 Progress Software Corporation
  35. 35. Documents Storage 5 © 2009 Progress Software Corporation
  36. 36.  Document storage company; terabytes of data per day. • Moving from an closed-source solution to ActiveMQ. – It'll scale in price, but will it scale in deployment?? • ActiveMQ put through rigorous performance tests. – And was selected for next generation system :) – Get the results from the white paper at fusesource.com. 6 © 2009 Progress Software Corporation
  37. 37. Summary  ActiveMQ, CXF, ServiceMix, Camel: • Focussed on messaging, integration, SOA enablement • Reliable, clustered, highly-available infrastructure •  The Apache Software License is scalable. • This is a major attraction for many adopters. •  Futures • Movement to OSGi runtime in SMX4 • Supporting “SOA” & “REST” architectures 7 © 2009 Progress Software Corporation

×