Professional Documents
Culture Documents
Introduction To Apache Synapse: Hiranya Jayathilaka
Introduction To Apache Synapse: Hiranya Jayathilaka
to Apache
Synapse
Hiranya Jayathilaka
(hiranya@apache.org)
What to Expect…
• The problem and the solution
– Integration problems in enterprise
• Introducing Apache Synapse
– Architecture and the functional components
• Case Studies
– Synapse in action
• Finishing touches
– Extension points and next steps
The Problem & The Solution
Software in Enterprise
• Large enterprises have many software
systems
– Enterprise resource planning applications
– Management information systems
– Decision support systems
– Executive support applications
• The systems are often independent
• But they are all parts of a larger business
process
Need for Enterprise Integration
• Individual software systems cannot
achieve much
• Systems should be integrated to work
together
– Enables free data flow across the firm
– Each application becomes aware of the ‘big
picture’
– Improves operational and management
efficiency
Easier Said Than Done!
• Integrating a multitude of complex
applications is no child’s play
• Systems are diverse (way too diverse)
– Different platforms (OS and program runtime)
– Different programming languages
– Different messaging standards and protocols
– Different QoS requirements
Is It Possible at All?
ESB to the Rescue!
• A software architecture construct that
provides fundamental services for complex
architectures
– Message routing
– Message transformation
– Protocol switching
– Adding QoS to message flows
– And everything else integration architects
would ever need
ESB Explained!
• An architectural style or an piece of
software that resembles a physical data
bus
• Applications communicate via the bus,
which acts as a message broker
• Replaces direct contact between software
– Reduces coupling
• Based on industry standards
ESB Saves the Day!
Introducing Apache
Synapse
What is Apache Synapse?
• A high performance ESB implementation
– Fast
– Lightweight
– Low resource usage
• Easy to configure and deploy
• Developed as a middleware with many
extension points
• Very mature and stable code base
Key Features
• Supports many messaging standards
– SOAP 1.1/1.2 and WS* standards
– REST/POX
• A wide range of communication protocols
– HTTP/S, JMS, Mail, VFS, FIX, AMQP
• Load balancing and fail over support
• Task scheduler and the eventing mode
• JMX monitoring support
Architecture
• Non blocking HTTP transport
– Network IO do not hog server worker threads
– Based on Apache HTTP Core NIO
• Multithreaded mediation engine
• Streaming model
– The byte stream coming over the wire is
‘streamed’ through the mediation engine
– Powered by Apache AXIOM
Functional Components
• Responsible for processing messages
inside the ESB and coordinating bus
activities
• Can be combined, mixed and matched to
implement complex message flows and
enterprise integration patterns
• The task of configuring Synapse is most of
the time putting the right set of functional
components together
Mediators
• The simplest functional component
• Takes an input message, performs some
action on it and outputs the processed
message
Sequences
• A cascading chain of mediators
• Input messages are sent through all the
child mediators of the sequence
• Resembles an industrial pipeline
Endpoints
• Defines an endpoint reference (EPR) to
which messages can be sent/forwarded
from Synapse
• Various operational constraints can be
enforced on endpoints
– Timeout configuration
– Message format (SOAP 1.1/1.2, POX)
– QoS expectations (WSSecurity, WSRM)
Proxy Services
• Acts like a virtual service that can accept
requests from clients
• Received client requests are processed
and forwarded to an actual service
implementation
• Response from the backend service is
processed and routed back to the clients
Other Components
• Scheduled Tasks
– Used to run a programmed activity periodically
• Event sources
– Enables Synapse to act as an event broker in an
event driven architecture
• Local entries
– Used to store small configuration/data items
• Registry
– A metadata store for your SOA
Configuration Model
• Synapse configuration language is used to
define, configure and combine functional
components
• XML based
• Very intuitive – Easy to learn, understand
and remember
• Entire configuration goes into the
synapse.xml file
Case Studies
Case Study 01
• Problem:
– How to expose an existing service over a
different schema?
• Solution:
– All the incoming requests should be transformed
into the format expected by the service
– All the responses should be transformed to the
format expected by the client
Solution Structure
Demonstration
Case Study 02
• Problem:
– How to expose an existing HTTP service over
JMS?
• Solution:
– A new (virtual) service should be created to
accept messages over JMS
– The virtual service should forward the
messages to the existing service over HTTP
Solution Structure
Demonstration
Want to Try More?
• Apache Synapse is shipped with a large
number of sample configurations that you
can try out of the box
• Follow the samples guide included in the
distribution or refer the online version of it:
– http://synapse.apache.org/Synapse_Samples.html
• Java and Apache ANT are required to try
out the samples
Finishing Touches
Extension Points
• Custom mediators
• Custom tasks
• Script mediator
• POJO command mediator
• Spring mediator
• Transport receivers and senders
• Load balance algorithms
• Message formatters and builders
Feel Like Contributing?
• Project website
– http://synapse.apache.org
• Code base
– https://svn.apache.org/repos/asf/synapse
• Mailing lists
– http://synapse.apache.org/maillists.html
• JIRA Issue tracker
– http://issues.apache.org/jira/browse/SYNAPSE
Questions?
Thank You!