Introduction to Inbound Endpoints in WSO2 ESB 4.9.0 (HTTP/S, File, JMS)

Preview:

Citation preview

Introduction to Inbound Endpoints

Isuru Udana

Associate Technical Lead

Viraj SenevirathneSoftware Engineer

Nov 2015

About the Presenters

● Isuru Udana Associate Technical Lead WSO2

● Viraj Senevirathne Software Engineer WSO2

Outline● Background

● ESB Basics

● Introduction to Inbound Endpoints

● HTTP Inbound Endpoint

● JMS Inbound Endpoint

● File Inbound Endpoint

● Demo

● Q & A

WSO2 ESB● A lightweight, high performance ESB

● Feature rich and standards compliant

○ SOAP and WS-* standards

○ REST support

● Domain specific protocol support (eg: FIX, HL7)

● User friendly and highly extensible

● 100% free and open source with commercial support

Key Features - Routing

Key Features - Filtering

Key Features - Transformation

Key Features - Protocol Switch

Key Features - Load Balancing

Key Features - Quality of Service

WSO2 ESB Basics

High Level Message Flow

High Level Message Flow

Basic Constructs

Building Blocks

Programming Model

Invoking Messages Flows

Messages can be injected into sequences through the following

interfaces:

Invoking Messages Flows Proxy Services● Acts like a virtual service.

● Receives messages and mediates them before sending them to the

endpoint (usually an actual service)

Eg: Perform necessary transformations and/or introduce additional

functionality without changing existing service.

Invoking Messages Flows

APIs (HTTP Services)● APIs can accept REST messages which allow clients to provide

additional information on how to manage the message

● Unmanaged API (API-Manager for managed APIs) ● Can handle multiple URLs

● Can handle parameters in the URL

Invoking Messages Flows

Main Sequence● Messages not destined for Proxy Services/API are sent through Main

Invoking Messages Flows Tasks● Allow configuration of scheduled jobs to execute internal/external

commands

● Inject a message into a proxy service, Main sequence or a named

sequence

Invoking Messages Flows Inbound Endpoints● Newly introduced in ESB 4.9.0 release

● New Message Entry point

Inbound Endpoints

Inbound Endpoints● New Message Entry point

Why Inbound Endpoints ?Limitations prior to ESB 4.9.0

● Conventional axis2 based Transports does not support dynamic

configuration

Ex: To change the ports, restart is required

axis2.xml configuration

Why Inbound Endpoints ?Limitations prior to ESB 4.9.0

● Multi-tenancy support is limited

○ Only HTTP Transport supports multi-tenancy

Inbound Endpoints Features

● A message source that can be configured dynamically

● Inbound architecture allows Multi-tenancy for all transports

○ JMS, VFS, HL7, etc

Inbound Endpoints Features

● Coordination Support

○ Controlled execution on clustered environment

○ Worker-Manager deployment for all transports

Inbound Endpoints Features

Coordination Support - Single Consumer

Inbound Endpoints Features

Inbound Endpoints FeaturesCoordination Support - Multiple Consumer

● Injects messages directly from transport layer to mediation layer without going through the axis2 engine

● Dedicated thread pools per inbound

● Extending the functionality with custom inbound endpoints

Inbound Endpoints Features

Inbound Endpoint Types● Listening Inbound Endpoints

● Polling Inbound Endpoints

● Event Based Inbound Endpoints

● Custom Inbound Endpoints

Listening Inbound Endpoint● In this endpoint type messages send to the inbound endpoint by client.

○ Ex: HTTP, HTTPS

● Starts message listening interfaces dynamically

● Fully supported in multi-tenant environments.● HTTP, HL7, WS-RM, TCP Inbound Endpoints

● Dynamically creates message polling interfaces.

Ex: JMS Inbound Endpoint – polls a given JMS queue and inject messages into an

ESB message flow.

● The the inbound endpoint will perform polling task with that specified time interval.

● We have to specify a polling interval when creating these type of inbound

endpoints.

Ex: File, JMS, Kafka

● Fully supported in multi-tenant environments ● Coordination support

Polling Inbound Endpoint

Event Based Inbound Endpoints● This endpoint task will run only once to establish connection with remote server.

This connection will be used for executing inbound endpoint task.

Ex: MQTT, RabbitMQ

Custom Inbound Endpoints

● Custom Inbound Endpoints are user defined inbound endpoints for custom tasks.

○ You will have to extend following classes for different implementations

■ Custom Listening Inbounds - GenericInboundListener

■ Custom Polling Inbounds - GenericPollingConsumer

HTTP Inbound Endpoint

● Dynamically configurable http and https endpoints at ESB runtime

○ Can create separate HTTP or HTTPS listeners which can handle messages separately

● Can directly inject messages to APIs, Proxies and sequences.

○ e.g.: There is a HTTP inbound endpoint running on port 8290.In order to inject messages

to a,

■ API (stockquote) - http://127.0.0.1:8290/stockquote/view/IBM

■ Proxy(StockQuoteProxy) - http://localhost:8290/services/StockQuoteProxy

■ Sequence - http://localhost:8290

● It is possible to specify different worker pool configuration for any inbound endpoint

HTTP/HTTPS Inbound Endpoint

HTTP and HTTPS Inbound Endpoints

Important parameters used in HTTP and HTTPS Inbound Endpoint

Parameter Description

inbound.http.port The port on which the endpoint listener should be started.( HTTP and HTTPS)

keystore The KeyStore location where keys are stored.( HTTPS Only)

Worker Pool Configuration Parameters (Optional)

inbound.worker.pool.size.core The initial number of threads in the worker thread pool. This value can be changed accordingly based on the number of messages to be processed. (default 400)

inbound.worker.pool.size.max The maximum number of threads in the worker thread pool. (default 500)

Proxy Configurations related to HTTP/HTTPS inbound endpoints

inbound.only Whether the proxy service needs to be exposed only via inbound endpoints.

Sample HTTP Inbound Configuration

HTTP and HTTPS Inbound Endpoints

JMS Inbound Endpoint

● This is a much improved alternative to JMS Transport

● Supports multi-tenancy unlike JMS Transport

● JMS inbound protocol implementation can receive messages from active

JMS server

● Supports coordination in clustered environment

JMS Inbound Endpoint

Important parameters used in JMS Inbound Endpoint

JMS Inbound Endpoint

Parameter Description

Interval How frequently JMS inbound should poll the source JMS locationEg: 10 (ms)

sequential Set this to true if you want to process list of messages one after another.

coordination Set this to true if you want JMS polling in one instance at a time in a clustered environment

java.naming.factory.initial The JNDI initial context factory class. This class must implement the java.naming.spi.InitialContextFactory interface.

java.naming.provider.url The URL of the JNDI provider.

transport.jms.Destination The JNDI name of the destination.

transport.jms.ConnectionFactoryJNDIName The JNDI name of the connection factory.

Sample JMS Inbound Configuration

JMS Inbound Endpoint

File Inbound Endpoint

● This is a much improved alternative to VFS Transport

○ Improved functionality over VFS Transport

○ Improved Error handling

● Supports multi-tenancy unlike VFS Transport

● Supports coordination in clustered environment

○ When co-orrdination is enabled in clustered environment file inbound

task will run on only one ESB instant at a time

● Capable of handling major major file systems like local file system, ftp, sftp,

smb etc.

File Inbound Endpoint

Important parameters used in File Inbound Endpoint

File Inbound Endpoint

Parameter Description

transport.vfs. FileURI Specifies file source. Should use file system prefix in front of the location uri.Eg: file://<path>

Interval How frequently file inbound should poll the source file locationEg: 1000 (ms)

sequential Set this to true if you want to process list of files one after another

coordination Set this to true if you want file polling in one instance at a time in a clustered environment

transport.vfs. ContentType Content type of the files processed by the file inbound. To specify the encoding when reading a file, follow the content type with a semi-colon and the character set.Eg: text/plain;charset=UTF-32

transport.vfs. ActionAfterProcesstransport.vfs. ActionAfterFailuretransport.vfs. MoveAfterProcesstransport.vfs. MoveAfterFailure

These parameters can be used to specify the operation that should be done after processing a file or incase of processing failure

transport.vfs.DistributedLock This applies only in cluster deployments. Set to true if you need to avoid multiple servers trying to process the same file simultaneously.

Sample File Inbound Configuration

File Inbound Endpoint

Demo

QnA