Professional Documents
Culture Documents
WSO2 Training ESB Fundamentals PDF
WSO2 Training ESB Fundamentals PDF
Product Configuration
WSO2 Training
Objectives
wso2.com/products
WSO2 Platform
ESB and SOA
Terminology and Background
Enterprise Reality
Diverse Business Cloud
Requirements APIs
No
Single
Vendor
Legacy
Systems
Scalability, Maintainability,
Troubleshooting
Leveraging the ESB
What is ESB?
o Key Benefits
o Open Standards (WSDL, SOAP, JMS, HTTP, FTP…)
o Increased flexibility; easier to change as requirements change
o Scales from point-solutions to enterprise-wide deployment
(distributed bus)
o Configuration rather than integration coding
o No central rules-engine, no central broker
When to Use an ESB?
o http://wso2.com/use-cases/enterprise-integration-and-esb
ESB in the Context of SOA
o What is SOA?
o Architectural approach based on discrete pieces of software
providing functionality as services to other applications. Services
are well defined and reusable.
o Pre-requisite Reading:
o Web Services – Application component that communicates via
open protocols. Deployed on a server that can expose the service
o WSDL – Web Service Description Language. A standard meta-
language to describe the services offered
o UDDI – Universal Description, Discovery and Integration
specification. A mechanism to register and locate WS-based
applications
o SOAP – Simple Object Access Protocol. A Standard way for
communication
ESB in the Context of SOA
o ESB Management
o Provide a common set of management capabilities
o These include Alerting, Statistics, Audit and Logging
o XML Performance
o Minimum overhead (scalable and performant)
o non-blocking IO (no block while waiting for response)
o Streaming XML (no in-memory buffer or full parsing)
ESB_HOME - Directory Structure
Introduction to
WSO2 ESB
Working with WSO2 ESB
1 2 3
In Sequence
Client 6 5 4 Service
Out Sequence
!
Fault Seq.
Building Blocks
Sequences Endpoints
Client Service
Transports Mediators
Building Blocks
o Sequences
o Define logic for handling incoming (request) and outgoing
(response) messages
o Sequences list mediators in order of execution
o Mediators
o Take action on the message
o Filter, Transform, Drop, Send, Property, Payload Factory
o Endpoints
o Define external destination for a message, usually a service
o Transports
o Carry messages in a specific format
Triggering Messages
o Proxy Services
o Main Sequence
Service
o APIs (http Services)
o Tasks
o Inbound Endpoints
Triggering Messages
Proxy Services
o Acts like a virtual service. Receives messages and mediates them
before sending them to the endpoint (usually an actual service)
o Examples:
o Perform necessary transformations and/or introduce
additional functionality without changing existing service
o Online License Renewal Scenario
Proxy Service
Service
Triggering Messages
Main Sequence
o Messages not destined for Proxy Services are sent through Main
o Examples:
o Default sequence for non-qualified messages
o Send all messages to Main for logging before being redistributed
to other Proxy services
Main Sequence
Service
Building Blocks: Sub-sequences
Sequences
Building Blocks: Sub-sequences
Sequences
Error Sequences
Triggering Messages
API
Service
Triggering Messages
Tasks
o Allow configuration of scheduled jobs to execute internal/external
commands
o Inject a message into a proxy service, Main sequence or a named
sequence
o Example:
o ESB allows scheduled tasks to go fetch data
Service
Manipulating Messages with XPath
XPath is a language that describes a way to
locate and process items in XML documents Input XML
//book Selects all book elements no matter where they are in the document
/bookstore/book[1] Selects the first book element that is the child of the bookstore element.
/bookstore/book[last()] Selects the last book element that is the child of the bookstore element
/bookstore/book[position()<3] Selects the first two book elements that are children of the bookstore element
//title[@lang] Selects all the title elements that have an attribute named lang
//title[@lang='en'] Selects all the title elements that have an attribute named lang with a value of 'en'
/bookstore/book[price>35.00] Selects all the book elements of the bookstore element that have a price element with a
value greater than 35.00
Lab Reference: ESB and Developer Studio
1 2 3
Dev Studio
(Eclipse)
5
Soap UI WSO2 WSO2 AS
(Client) ESB (Back-end
Services)
WSO2 ESB
Enterprise Integration Patterns
Enterprise Integration Patterns
EIPs
o A set of standards in architecting integration patterns
o EIP Catalog: http://www.eaipatterns.com/toc.html
Switch Mediator
o Allows content-based routing
o Evaluates the XPath or JSONPath and returns a string. This string is
evaluated against a regular expression in each case statement.
o If a matching case is found, no others are evaluated. If no match,
a default will be executed.
Class Exercise:
o Review mediator documentation and identify:
– How to configure
– Proper syntax
– Sample usage
o https://docs.wso2.org/display/ESB490/Switch+Mediator
Traffic Filtering
Filter Mediator
o Resembles the if-else control structure, filtering messages based
on the Xpath or JSONPath
o 2 modes of operation:
o If user only specifies XPath or JSONPath, it evaluates as true or false.
o If user specifies a regular expression as well, the string returned from
evaluating the XPath or JSONPath will be matched against the regular
expression.
o https://docs.wso2.org/display/ESB481/filter+mediator
Service Chaining
Service Chaining
o A collection of mediators that allows multiple services to be
exposed as one service to outside world
o Orchestrates responses from one system that are needed as inputs
for other services
o Best Practices: Makes use of IN, CALL and RESPONSE mediators for
simpler coordination of requests and responses to/from the various
services
o Online License Renewal Scenario
Message Transformation
PayloadFactory Mediator
o Transforms or replaces the contents of a message by allowing user
to define a new format
o Arguments can be inserted into the new format – arguments can be
a static value, an Xpath or a JSON expression
o By default, JSON messages are converted to XML
o https://docs.wso2.org/display/ESB481/PayloadFactory+Mediator
Protocol Switching
Switching Transports
o Allows user to change a message from one protocol to another
o i.e. An http message can be translated to a JMS message
o https://docs.wso2.org/display/ESB481/Sample+250%3A
+Introduction+to+Switching+Transports
Message Format Switching
Format Switching
o Allows user to change the message between common formats
o i.e. The client sends a JSON request but the existing service uses
XML SOAP (For this example, a message translator is needed in
each direction - request and response)
o https://docs.wso2.org/display/ESB481/Sample+152%3A+Switching
+Transports+and+Message+Format+from+SOAP+to+REST+POX
Store and Forward
Message Stores
o Allows users to temporarily store messages before they are finally
delivered to their destination by a message processor (For example,
to slow down the delivery rate).
o Use the Store mediator to create In Memory (default), JMS or a
custom message store (i.e for Guaranteed Delivery)
o https://docs.wso2.org/display/ESB481/Message+Stores
Message Processors
o Used to deliver messages that have been temporarily stored in a
message store
o http://docs.wso2.org/display/ESB481/Adding+a+Message+Processor
WSO2 ESB
Triggering Messages
Triggering Messages - Review
✓Proxy Services
o
✓Main Sequence
o
Service
o APIs (http Services)
o Tasks
o Inbound Endpoints
APIs - Introduction
REST
Customer
Application
WSO2 SOAP WSO2
ESB AS
(API) (OMS)
REST
Barista Admin
Application
Creating APIs
o Resources
o Component of API accessed through HTTP call
o Similar to proxy service (in, out, and fault sequences)
o Can restrict resource’s scope using URL patterns and URI
templates
Creating APIs
o URL mapping
o Path mappings (eg: /test/*, /foo/bar/*)
o Extension mappings (eg: *.jsp, *.do)
o Exact mappings (eg: /test, /test/foo)
o URI template
o /order/{orderId} would process /order/A0001
o /dictionary/{char}/{word} would process
/dictionary/c/cat
POX SOAP
REST Client WSO2 SOAP
ESB Service
Creating APIs : Trace and QOS
✓Proxy Services
o
✓Main Sequence
o
✓APIs (http Services)
o
Service
o Tasks
o Inbound Endpoints
Working with Tasks
✓Proxy Services
o
✓Main Sequence
o
✓APIs (http Services)
o
Service
✓Tasks
o
o Inbound Endpoints
Working Inbound Endpoints
axis2.xml configuration
Why Inbound Endpoints ?
Limita'ons prior to ESB 4.9.0
● Mul1-tenancy support is limited
○ Only HTTP Transport supports mul1-tenancy
Inbound Endpoints Features
● A message source that can be configured dynamically
Inbound Endpoints Features
● Inbound architecture allows Mul1-tenancy for all transports
○ JMS, VFS, HL7, etc
Inbound Endpoints Features
● Coordina1on Support
○ Controlled execu1on on clustered environment
○ Worker-Manager deployment for all transports
Inbound
Endpoints Features
Coordina'on Support - Single Consumer
Inbound Endpoints Features
Coordina'on Support - Mul'ple Consumer
Inbound Endpoints Features
● Injects messages directly from transport layer to media1on layer
without going through the axis2 engine
● Dedicated thread pools per inbound
● Extending the func1onality with custom inbound endpoints
Inbound Endpoint Types
● Listening Inbound Endpoints
o Security
o Enable predefined security scenarios (WS-Security)
o Apply security policies (WS-Policy)
o Reliable Messaging (WS-Reliable Messaging)
o Response Caching
o Access Throttling
o Message Transformation Optimization Mechanism (MTOM)
o QoS Attributes
o Transports
o Module Engagement
o Parameters
o Operations
o https://docs.wso2.org/display/ESB481/Managing+Web+Services
WSO2 ESB
Application Deployment
Application Deployment
Migrating Environments
DEV QA PROD
C-App
CAR
1. Create Composite Application Project (C-App) from ESB Config project
2. Export C-App as a Composite Application Archive (CAR) file
3. Upload CAR file into target ESB instance
Packaging Artifacts and Deployment
1. Create a Composite Application (C-App)
o A C-App is a collection of artifacts (i.e. endpoints, mediators)
which can be deployed on a Carbon instance to easily port your
web services solutions from one environment to another
ESB Registry
o Carbon core provides basic registry and repository functionality.
o Local repository (/_system/local): Stores config and runtime data
local to server. Rarely used.
G-REG
o Setting Up
o https://docs.wso2.org/display/ESB481/Setting+Up+Logging
o Edit log4j.properties or Configure through Managment Console
o Enable wire logs (logs header/payloads of everything entering/
exiting ESB)
Monitoring Tools
Statistics
o https://docs.wso2.org/display/ESB481/Statistics
Mediation Tracer
o https://docs.wso2.org/display/ESB481/Mediation+Tracer
SOAP Tracer
o https://docs.wso2.org/display/ESB481/SOAP+Tracer
JMX Monitoring
o https://docs.wso2.org/display/ESB481/JMX+Monitoring
TCPMon Monitoring
o https://docs.wso2.org/display/ESB481/TCPMon+Monitoring
Message Flow Handlers
o https://docs.wso2.org/display/ESB481/Viewing+the+Handlers+in
+Message+Flows
Message Flows
ESB Monitoring
o This Graphical View provides a view of what is configured.
Error Handling
Runtime exceptions are common when dealing with a variety of
applications, networks, wire level protocols, remote APIs, etc.
Handling these exceptions gracefully is key.
1
CLIENT CLIENT CLIENT
User Stores
o Db where users/roles details are stored (name, email, passwd)
o User Store can run in read/write mode or in read-only mode
https://docs.wso2.org/display/ESB481/User+Management
User Management – Carbon Kernel
o ESB 4.8.1
o http://docs.wso2.org/display/ESB481/WSO2+Enterprise
+Service+Bus+Documentation