introduction to apache synapse

34
Introduction to Apache Synapse Hiranya Jayathilaka ([email protected])

Upload: hiranya-jayathilaka

Post on 07-Dec-2014

5.689 views

Category:

Technology


11 download

DESCRIPTION

This is the presentation I did at Apache Asia Roadshow 2009 held at Colombo, Sri Lanka. My talk was titled "Introduction to Apache Synapse". In this presentation, I attempt to address areas like enterprise integration problems, ESB pattern, Synapse architecture, features and the configuration model.

TRANSCRIPT

Page 1: Introduction to Apache Synapse

Introduction to Apache Synapse

Hiranya Jayathilaka([email protected])

Page 2: Introduction to Apache Synapse

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

Page 3: Introduction to Apache Synapse

The Problem & The Solution

Page 4: Introduction to Apache Synapse

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

Page 5: Introduction to Apache Synapse

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

Page 6: Introduction to Apache Synapse

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

Page 7: Introduction to Apache Synapse

Is It Possible at All?

Page 8: Introduction to Apache Synapse

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

Page 9: Introduction to Apache Synapse

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

Page 10: Introduction to Apache Synapse

ESB Saves the Day!

Page 11: Introduction to Apache Synapse

Introducing Apache Synapse

Page 12: Introduction to 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

Page 13: Introduction to Apache Synapse

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

Page 14: Introduction to Apache Synapse

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

Page 15: Introduction to Apache Synapse

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

Page 16: Introduction to Apache Synapse

Mediators

• The simplest functional component• Takes an input message, performs some 

action on it and outputs the processed message

Page 17: Introduction to Apache Synapse

Sequences

• A cascading chain of mediators• Input messages are sent through all the 

child mediators of the sequence• Resembles an industrial pipeline

Page 18: Introduction to Apache Synapse

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 (WS­Security, WS­RM)

Page 19: Introduction to Apache Synapse

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

Page 20: Introduction to Apache Synapse

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

Page 21: Introduction to Apache Synapse

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

Page 22: Introduction to Apache Synapse

Case Studies

Page 23: Introduction to Apache Synapse

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

Page 24: Introduction to Apache Synapse

Solution Structure

Page 25: Introduction to Apache Synapse

Demonstration

Page 26: Introduction to Apache Synapse

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

Page 27: Introduction to Apache Synapse

Solution Structure

Page 28: Introduction to Apache Synapse

Demonstration

Page 29: Introduction to Apache Synapse

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

Page 30: Introduction to Apache Synapse

Finishing Touches

Page 31: Introduction to Apache Synapse

Extension Points

• Custom mediators• Custom tasks• Script mediator• POJO command mediator• Spring mediator• Transport receivers and senders• Load balance algorithms• Message formatters and builders

Page 32: Introduction to Apache Synapse

Feel Like Contributing?

• Project website– http://synapse.apache.org

• Code base– https://svn.apache.org/repos/asf/synapse

• Mailing lists– http://synapse.apache.org/mail­lists.html

• JIRA Issue tracker– http://issues.apache.org/jira/browse/SYNAPSE

Page 33: Introduction to Apache Synapse

Questions?

Page 34: Introduction to Apache Synapse

Thank You!