Enterprise Service Bus (ESB) and SOA


              Paul Fremantle
             paul@wso2.com
        CTO and Co-Founder, WSO2
           VP, Apache Synapse
SOA – Enterprise Expectations
Standards




         • A set of extensible and composable standards that work together
         • Providing a common, standard, interoperable base to implement
                                       SOA


  SOA & SOAP                 Core Axis: WS with Apache Axis2             3
                                      © WSO2 Inc. 2006
A Sample SOAP Message


<soap:Envelope
  xmlns:soap="http://schemas.xmlsoap.org/soap/envel
  ope/">
 <soap:Header/>
 <soap:Body>
  <getProductDetails
     xmlns="http://warehouse.example.com/ws">
     <productID>827635</productID>
  </getProductDetails>
  </soap:Body>
</soap:Envelope>



 SOA & SOAP         Core Axis: WS with Apache Axis2   4
                             © WSO2 Inc. 2006
Key SOA Standards

Orchestration                     Business Process Execution Language (BPEL)‫‏‬

                SECURE                         RELIABLE                   TRANSACTIONAL




                                                                                                            WS-Policy
                WS-Security                    WS-ReliableMessaging       WS-AtomicTransaction
  Composable




                                                                                                                        WS-MetadataExchange
                     (encrypt, sign, auth)‫‏‬    (ExactlyOnce,              (2 Phase Commit ~XA)‫‏‬
  Quality       WS-SecureConversation          InOrder delivery, ~JMS)‫‏‬
  of                 (~SSL)‫‏‬                                              WS-BusinessActivity
                WS-Trust                                                  (Long running loosely coupled)‫‏‬
  Service
                XACML


                                                  WS-Addressing
   Messaging




                                                                                                            WSDL
                                                         SOAP

   Transport                                  HTTP, TCP, SMTP, UDP
                                                     Wire interaction                                       Metadata

    The Web services platform forms a complete framework for open
    standards enterprise middleware

  SOA & SOAP                              Core Axis: WS with Apache Axis2                                                              5
                                                     © WSO2 Inc. 2006
Other key approaches for SOA

• JMS
  – MQSeries, Tibco, Sonic
  – ActiveMQ, AMQP, Apache QPid
  – Loosely coupled, asynchronous reliable message passing
• REST
  –   A style of using HTTP
  –   Representational State Transfer
  –   Most HTTP applications are NOT “RESTful”
  –   Key characteristics of a RESTful app:
       • Use HTTP Verbs properly
       • Use mime-types properly
       • Use linking everywhere
       • Permanent URLs
Bus concept
Busbar
A common ESB definition

 “Any to any data connectivity and transformation
   (including Web Services) built on an advanced,
   proven, reliable middleware infrastructure”
ESB definition

 “Any to any data connectivity and transformation
   (including Web Services) built on an advanced,
   proven, reliable middleware infrastructure”
 which means
 • Our existing middleware re-branded as an SOA
   platform, with some new web services adapters at
   the edges
Jason Bloomberg, Zapthink

  “You're a software vendor with a product line chock full
  of proprietary, tightly-coupled integration middleware…
  Your software, however, does not lend itself to SOA best
  practices – loose coupling, composable Services, and
  flexibility in general are all capabilities that you failed to
  build             into            your             software…
  What to do? The only option is to slap Web Services
  interfaces on your stuff, call it an Enterprise Service Bus
  (ESB), and sell it as SOA middleware. Hopefully your
  customers won't notice the old wine in new bottles.
  After all, that's what marketing is for!”
My definition of an ESB

“What does it do?” not “How does it do it?”
• Services are independent of the transport and protocol
  used to access them
• Monitors and manages services with minimal intrusion
• Transforms and mediates messages
• Bridges between different message exchange patterns
• Helps implement service governance
• Provides a common backbone to the SOA
Do you need an ESB to do SOA?
Do you need an ESB to do SOA?
SOA can end up as spaghetti




  • Too many point-to-point links
  • Multiple protocols, different qualities of service
  • No clear picture of all available services
An ESB can simplify SOA deployment




                                     Virtualization
                                     Perf Mgmt
                                     •Load balance
                                     •Throttle
                                     Transport
                                      matching
                                     Access control
                                     Message
                                       transform
                                     Logging and
                                      auditability



                                                      Integrated
                                                       Registry/
                                                      Repository
                      Web-based console
ESB Patterns and Anti-Patterns

• How are ESBs used effectively
• How are they abused
   – High-level patterns
      • How the ESB fits into an organization
      • How the ESB fits into an Enterprise Architecture
   – Low-level patterns
      • How the ESB fits into a specific message flow or business problem
The Concentrator Pattern


                        Mashup/Web Application
                             Dashboard



                           Concentrator ESB
         Consistent access, security, logging, audit, monitoring
                        But no transformation



    .NET           CRM            Apache
                                                   C/C++            Data
   service        service          Axis2
                                                  service          service
                                  service
The Federated ESB pattern

                                          Department
                                             ESB


                    Enterprise ESB
                    Routing, Audit
     Department
        ESB


                                     Department
                                        ESB
The mini-ESB pattern

•   Use a lightweight ESB
•   Co-locate on the same hardware/VM as the service
•   Transformation, polling, protocol translation, etc
•   Why?
    – In the control of the team who own the services
    – Keeps the SOA model (ownership) with a simple effective
      approach to exposing services

• What about the embedded ESB model?
    – e.g. embed transformation and logging into your Service
      Hosting platform
Active vs Passive

• The concentrator pattern is effectively passive
   – The ESB reacts to messages/requests from the front-end
• Active ESBs:
   – Poll file systems/FTP/SFTP for updated work
   – Actively call remote services based on timers
   – Integrate passive services
Scenario – Financial Security blocking




   Existing
   System
                                              XML/JMS



    legacy
    flat file                                           Existing
                                                        System
                               WSO2 ESB
                              Split/Iterate
                            DBLookup/Filter
                            Transform to MQ
                                  Send




   WSO2 ESB                    Database
     Poll
 Record->XML
  XML->XML
     Send
 NEW YORK                   LONDON
Push-Me Pull-You
Push-me Pull-you
Anti-Patterns

• Anti-Pattern #1
   – Implement all your business logic in the ESB
   – Why not?
      • Mixing Infrastructure logic and Business Logic
      • Maintainability
      • Tooling and Skills
• Anti-Pattern #2
   – Apply waterfall and application deployment approaches to
     the ESB
      • Long project cycles
      • No iterative approach
   – Why not?
      • Lose all flexibility and agility
      • Once the ESB becomes a static, code-driven system then you would
        be better off updating your applications
Anti-Pattern #3

• “Big Brother”
   – The ESB is hosted, managed and controlled by a central IT
     team
   – Because of organizational issues using the ESB is complex:
      • e.g.
          – It takes months of meetings to get access
          – The Central IT team is trying to recoup the investment and internally
            charges $000/year to use the ESB
          – The central IT deployment model holds up users
   – Departments and divisions actually sneak behind the ESB
      • Set up peer-to-peer communications
      • Avoid the ESB at all costs
The biggest Anti-Pattern of all

• Use an ESB because:
   – You heard it was a good idea
   – The salesman told you that you need one (over a nice
     dinner)
   – You need a new TLA on your resume/CV
   – Its an excuse to spend several months learning and going to
     conferences
ESB Market

• Proprietary
  – IBM WebSphere
  – Oracle/BEA
  – Tibco
• Open Source
  – Fuse/ServiceMix
  – MuleSource/Mule
  – WSO2 ESB/Synapse
Core model of the ESB

• Two main approaches
  – “Proxy” approach
     • Messages come into a proxy
        – Proxy = { inSequence, targetEndpoint, outSequence, faultSequence}
        – Sequence = { ordered list of mediators }
        – Mediator = Unit of function


  – Rule/Policy based approach
     • All messages come to a central sequence
        – Sequence categorizes and routes requests based on the message
     • Known in Synapse as the “main” sequence
Sequence concept
Built-in Mediators

   – Drop (end)                     –   Property
   – Sequence (call another         –   Header
     sequence)                      –   Validate
   – Clone                          –   DBReport
   – Callout (call a WS)            –   DBLookup
   – Filter (if-then-else)          –   Class mediator
   – Switch                         –   Command Mediator
   – Iterate                        –   Script
   – Aggregate                      –   Spring
   – Send                           –   Throttle
   – Router                         –   Cache
   – Smooks (transform library)     –   XSLT
   – Rule (use a Rules engine)      –   XQuery
   – Entitlement (validate access
     against a XACML server)
Understanding performance

• Performance of an ESB can be critical
• Key Measurements are
  – Throughput (can the ESB cope with the required load)
  – Latency (does the ESB add unacceptable time)
  – Concurrency (does the ESB run out of threads)

• Two key technologies
  – Streaming and Streaming XML
     • Ability to operate in constant memory and handle XML without
       building a full tree
  – Non-blocking IO
     • Ability to manage large numbers of connections with constant
       thread pool
Case Study

• Mobile phone ringtone/media provider
• Every request goes via the ESB
  – Performance and Streaming are critical
  – Streaming and non-blocking are key
• Continuous Availability
  – Ability to upgrade the system live
  – Without losing transactions
  – Under load
Governance and ESBs

• Governance is a key issue for SOA
• Governance is fundamentally about ensuring standards
  around Enterprise IT
  – Policies
  – People
  – Processes
• ESBs can be very important for this
  – Policy Enforcement Point
  – Monitoring Point
  – Central Access Point for enterprise services
Summary

• We have
  –   Identified how ESBs fit into a Service Oriented Architecture
  –   Discussed when to use an ESB and when not to
  –   Looked at ESB patterns and anti-patterns
  –   Covered some simple ESB approaches
  –   Investigated how ESBs can fit into EDA
Questions

ESB and SOA

  • 1.
    Enterprise Service Bus(ESB) and SOA Paul Fremantle paul@wso2.com CTO and Co-Founder, WSO2 VP, Apache Synapse
  • 2.
    SOA – EnterpriseExpectations
  • 3.
    Standards • A set of extensible and composable standards that work together • Providing a common, standard, interoperable base to implement SOA SOA & SOAP Core Axis: WS with Apache Axis2 3 © WSO2 Inc. 2006
  • 4.
    A Sample SOAPMessage <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envel ope/"> <soap:Header/> <soap:Body> <getProductDetails xmlns="http://warehouse.example.com/ws"> <productID>827635</productID> </getProductDetails> </soap:Body> </soap:Envelope> SOA & SOAP Core Axis: WS with Apache Axis2 4 © WSO2 Inc. 2006
  • 5.
    Key SOA Standards Orchestration Business Process Execution Language (BPEL)‫‏‬ SECURE RELIABLE TRANSACTIONAL WS-Policy WS-Security WS-ReliableMessaging WS-AtomicTransaction Composable WS-MetadataExchange (encrypt, sign, auth)‫‏‬ (ExactlyOnce, (2 Phase Commit ~XA)‫‏‬ Quality WS-SecureConversation InOrder delivery, ~JMS)‫‏‬ of (~SSL)‫‏‬ WS-BusinessActivity WS-Trust (Long running loosely coupled)‫‏‬ Service XACML WS-Addressing Messaging WSDL SOAP Transport HTTP, TCP, SMTP, UDP Wire interaction Metadata The Web services platform forms a complete framework for open standards enterprise middleware SOA & SOAP Core Axis: WS with Apache Axis2 5 © WSO2 Inc. 2006
  • 6.
    Other key approachesfor SOA • JMS – MQSeries, Tibco, Sonic – ActiveMQ, AMQP, Apache QPid – Loosely coupled, asynchronous reliable message passing • REST – A style of using HTTP – Representational State Transfer – Most HTTP applications are NOT “RESTful” – Key characteristics of a RESTful app: • Use HTTP Verbs properly • Use mime-types properly • Use linking everywhere • Permanent URLs
  • 7.
  • 8.
  • 9.
    A common ESBdefinition “Any to any data connectivity and transformation (including Web Services) built on an advanced, proven, reliable middleware infrastructure”
  • 10.
    ESB definition “Anyto any data connectivity and transformation (including Web Services) built on an advanced, proven, reliable middleware infrastructure” which means • Our existing middleware re-branded as an SOA platform, with some new web services adapters at the edges
  • 11.
    Jason Bloomberg, Zapthink “You're a software vendor with a product line chock full of proprietary, tightly-coupled integration middleware… Your software, however, does not lend itself to SOA best practices – loose coupling, composable Services, and flexibility in general are all capabilities that you failed to build into your software… What to do? The only option is to slap Web Services interfaces on your stuff, call it an Enterprise Service Bus (ESB), and sell it as SOA middleware. Hopefully your customers won't notice the old wine in new bottles. After all, that's what marketing is for!”
  • 12.
    My definition ofan ESB “What does it do?” not “How does it do it?” • Services are independent of the transport and protocol used to access them • Monitors and manages services with minimal intrusion • Transforms and mediates messages • Bridges between different message exchange patterns • Helps implement service governance • Provides a common backbone to the SOA
  • 13.
    Do you needan ESB to do SOA?
  • 14.
    Do you needan ESB to do SOA?
  • 15.
    SOA can endup as spaghetti • Too many point-to-point links • Multiple protocols, different qualities of service • No clear picture of all available services
  • 16.
    An ESB cansimplify SOA deployment Virtualization Perf Mgmt •Load balance •Throttle Transport matching Access control Message transform Logging and auditability Integrated Registry/ Repository Web-based console
  • 17.
    ESB Patterns andAnti-Patterns • How are ESBs used effectively • How are they abused – High-level patterns • How the ESB fits into an organization • How the ESB fits into an Enterprise Architecture – Low-level patterns • How the ESB fits into a specific message flow or business problem
  • 18.
    The Concentrator Pattern Mashup/Web Application Dashboard Concentrator ESB Consistent access, security, logging, audit, monitoring But no transformation .NET CRM Apache C/C++ Data service service Axis2 service service service
  • 19.
    The Federated ESBpattern Department ESB Enterprise ESB Routing, Audit Department ESB Department ESB
  • 20.
    The mini-ESB pattern • Use a lightweight ESB • Co-locate on the same hardware/VM as the service • Transformation, polling, protocol translation, etc • Why? – In the control of the team who own the services – Keeps the SOA model (ownership) with a simple effective approach to exposing services • What about the embedded ESB model? – e.g. embed transformation and logging into your Service Hosting platform
  • 21.
    Active vs Passive •The concentrator pattern is effectively passive – The ESB reacts to messages/requests from the front-end • Active ESBs: – Poll file systems/FTP/SFTP for updated work – Actively call remote services based on timers – Integrate passive services
  • 22.
    Scenario – FinancialSecurity blocking Existing System XML/JMS legacy flat file Existing System WSO2 ESB Split/Iterate DBLookup/Filter Transform to MQ Send WSO2 ESB Database Poll Record->XML XML->XML Send NEW YORK LONDON
  • 23.
  • 24.
  • 25.
    Anti-Patterns • Anti-Pattern #1 – Implement all your business logic in the ESB – Why not? • Mixing Infrastructure logic and Business Logic • Maintainability • Tooling and Skills • Anti-Pattern #2 – Apply waterfall and application deployment approaches to the ESB • Long project cycles • No iterative approach – Why not? • Lose all flexibility and agility • Once the ESB becomes a static, code-driven system then you would be better off updating your applications
  • 26.
    Anti-Pattern #3 • “BigBrother” – The ESB is hosted, managed and controlled by a central IT team – Because of organizational issues using the ESB is complex: • e.g. – It takes months of meetings to get access – The Central IT team is trying to recoup the investment and internally charges $000/year to use the ESB – The central IT deployment model holds up users – Departments and divisions actually sneak behind the ESB • Set up peer-to-peer communications • Avoid the ESB at all costs
  • 27.
    The biggest Anti-Patternof all • Use an ESB because: – You heard it was a good idea – The salesman told you that you need one (over a nice dinner) – You need a new TLA on your resume/CV – Its an excuse to spend several months learning and going to conferences
  • 28.
    ESB Market • Proprietary – IBM WebSphere – Oracle/BEA – Tibco • Open Source – Fuse/ServiceMix – MuleSource/Mule – WSO2 ESB/Synapse
  • 30.
    Core model ofthe ESB • Two main approaches – “Proxy” approach • Messages come into a proxy – Proxy = { inSequence, targetEndpoint, outSequence, faultSequence} – Sequence = { ordered list of mediators } – Mediator = Unit of function – Rule/Policy based approach • All messages come to a central sequence – Sequence categorizes and routes requests based on the message • Known in Synapse as the “main” sequence
  • 31.
  • 32.
    Built-in Mediators – Drop (end) – Property – Sequence (call another – Header sequence) – Validate – Clone – DBReport – Callout (call a WS) – DBLookup – Filter (if-then-else) – Class mediator – Switch – Command Mediator – Iterate – Script – Aggregate – Spring – Send – Throttle – Router – Cache – Smooks (transform library) – XSLT – Rule (use a Rules engine) – XQuery – Entitlement (validate access against a XACML server)
  • 33.
    Understanding performance • Performanceof an ESB can be critical • Key Measurements are – Throughput (can the ESB cope with the required load) – Latency (does the ESB add unacceptable time) – Concurrency (does the ESB run out of threads) • Two key technologies – Streaming and Streaming XML • Ability to operate in constant memory and handle XML without building a full tree – Non-blocking IO • Ability to manage large numbers of connections with constant thread pool
  • 34.
    Case Study • Mobilephone ringtone/media provider • Every request goes via the ESB – Performance and Streaming are critical – Streaming and non-blocking are key • Continuous Availability – Ability to upgrade the system live – Without losing transactions – Under load
  • 35.
    Governance and ESBs •Governance is a key issue for SOA • Governance is fundamentally about ensuring standards around Enterprise IT – Policies – People – Processes • ESBs can be very important for this – Policy Enforcement Point – Monitoring Point – Central Access Point for enterprise services
  • 36.
    Summary • We have – Identified how ESBs fit into a Service Oriented Architecture – Discussed when to use an ESB and when not to – Looked at ESB patterns and anti-patterns – Covered some simple ESB approaches – Investigated how ESBs can fit into EDA
  • 37.