understanding jms integration patterns

34
Miyuru Wanninayaka Senior Technical Lead Isuru Ranawaka Software Engineer Sep 24 2014 Understanding JMS Integration Patterns

Upload: wso2

Post on 21-Nov-2014

312 views

Category:

Technology


2 download

DESCRIPTION

 

TRANSCRIPT

Page 1: Understanding JMS Integration Patterns

Miyuru WanninayakaSenior Technical Lead

Isuru RanawakaSoftware Engineer

Sep 24 2014

Understanding JMS Integration Patterns

Page 2: Understanding JMS Integration Patterns

About the Presenters

๏ Miyuru Wanninayaka - [email protected]

Miyuru is a Senior Technical Lead in the integration technologies team where he mainly focuses on the WSO2 Enterprise Service Bus. In addition to his product development efforts, he has provided technology consulting on customer engagements, helping to successfully implement enterprise integration and mobile services gateway solutions

๏ Isuru Ranawaka - [email protected]

Isuru is a Software Engineer at WSO2. Previously an intern at WSO2 in 2012, Isuru worked on developing CEP artifact creater tool for WSO2 Developer Studio and enhancing performance of Siddhi CEP engine. He is a graduate from the Department of Computer Science and Engineering, University of Moratuwa. Isuru worked on developing distributed CEP as his final year project.

Page 3: Understanding JMS Integration Patterns

About WSO2

๏ Global enterprise, founded in 2005 by acknowledged leaders in XML, web services technologies, standards and open source

๏ Provides only open source platform-as-a-service for private, public and hybrid cloud deployments

๏ All WSO2 products are 100% open source and released under the Apache License Version 2.0.

๏ Is an Active Member of OASIS, Cloud Security Alliance, OSGi Alliance, AMQP Working Group, OpenID Foundation and W3C.

๏ Driven by Innovation

๏ Launched first open source API Management solution in 2012

๏ Launched App Factory in 2Q 2013

๏ Launched Enterprise Store and first open source Mobile solution in 4Q 2013

Page 4: Understanding JMS Integration Patterns

What WSO2 delivers

Page 5: Understanding JMS Integration Patterns

Agenda

๏ JMS

๏ WSO2 Message Broker

๏ Configuring JMS Transport of WSO2 ESB

๏ JMS Patterns with WSO2 ESB

๏ Beyond JMS

Page 6: Understanding JMS Integration Patterns

*

Introducing WSO2 ESB

๏ A lightweight, high performance ESB

๏ Comprehensive REST, SOAP, WS-* support

๏ 100% compliant with all EIPs (Enterprise Integration Patterns)

๏ Connectors (Salesforce, Twilio and many more)

๏ SAP, FIX, HL7 - Domain specific solutions

๏ Zero Code/Configuration driven

๏ Extensible and Scalable

Page 7: Understanding JMS Integration Patterns

๏ Messaging enables distributed communication that is loosely coupled

๏ Sender does not need to know about the receiver, nor does the receiver know anything about the sender

Messaging with MOM

Page 8: Understanding JMS Integration Patterns

๏ Is an API that allows applications to create, send, receive, and read messages

๏ Enables communication that is๏ Loosely coupled๏ Asynchronous - JMS provider can deliver messages as they

arrive, client does not have to request messages.๏ Reliable - The JMS API ensures that a message is delivered

once and only once

What is Java Message Service (API)

Page 9: Understanding JMS Integration Patterns

JMS Terminology

Page 10: Understanding JMS Integration Patterns

dest = (Destination) jndiContext.lookup(destName);queue = (Queue) jndiContext.lookup(queueName);

MessageProducer producer = session.createProducer(dest);TextMessage message = session.createTextMessage();message.setText(“Hello”);producer.send(message);

Message Producer, Consumer and Broker

Message Producer

Message Consumer

Message Broker

dest = (Destination) jndiContext.lookup(destName);queue = (Queue) jndiContext.lookup(queueName);

MessageConsumer consumer = session.createConsumer(dest);Message m = consumer.receive();

Page 11: Understanding JMS Integration Patterns

๏ Facilitates users to store messages sent by an external party, in an intermediate location and access them on-demand

๏ Enables users to publish messages and receive them in the order that they are sent

๏ Natively persistent๏ Even after shutting down the server or if a sudden crash

happens, messages still remain in the queue ready to be delivered

Queue

Page 12: Understanding JMS Integration Patterns

๏ Every message is delivered to all the subscribers๏ Non persistent unless durable subscription

Topic

Page 13: Understanding JMS Integration Patterns

๏ WSO2 MB is a message brokering system based on Java Messaging Service (JMS).๏ Any client that supports AMQP is able to communicate with

WSO2 Message Broker

๏ Can be used as a standalone message broker or a distributed message brokering system.

๏ Uses Apache Cassandra as its message store and Apache Zookeeper for distributed coordination

๏ Can put message to one MB node in the cluster and pick up the message from another node MB

What is WSO2 Message Broker?

Page 14: Understanding JMS Integration Patterns

๏ Enable JMS transport sender and receiver in axis2.xml

๏ Copy JMS client libraries provided by JMS broker to [ESB_HOME]/repository/components/lib

๏ https://docs.wso2.org/display/ESB481/Configuring+JMS+Transport

Configuring JMS transport of WSO2 ESB

<transportReceiver name="jms" class="org.apache.axis2.transport.jms.JMSListener"><parameter name="myTopicConnectionFactory" locked="false"> <parameter name="java.naming.factory.initial" locked="false">org.wso2.andes.jndi.PropertiesFileInitialContextFactory</parameter>

<parameter name="java.naming.provider.url" locked="false">repository/conf/jndi.properties</parameter><parameter name="transport.jms.ConnectionFactoryJNDIName" locked="false">TopicConnectionFactory</parameter><parameter name="transport.jms.ConnectionFactoryType" locked="false">topic</parameter>

</parameter>

<parameter name="myQueueConnectionFactory" locked="false"><parameter name="java.naming.factory.initial" locked="false">org.wso2.andes.jndi.PropertiesFileInitialContextFactory</parameter><parameter name="java.naming.provider.url" locked="false">repository/conf/jndi.properties</parameter><parameter name="transport.jms.ConnectionFactoryJNDIName" locked="false">QueueConnectionFactory</parameter>

<parameter name="transport.jms.ConnectionFactoryType" locked="false">queue</parameter></parameter>

<parameter name="default" locked="false"><parameter name="java.naming.factory.initial" locked="false">org.wso2.andes.jndi.PropertiesFileInitialContextFactory</parameter><parameter name="java.naming.provider.url" locked="false">repository/conf/jndi.properties</parameter><parameter name="transport.jms.ConnectionFactoryJNDIName" locked="false">QueueConnectionFactory</parameter><parameter name="transport.jms.ConnectionFactoryType" locked="false">queue</parameter>

</parameter></transportReceiver>

Page 15: Understanding JMS Integration Patterns

Patterns with JMS

Page 16: Understanding JMS Integration Patterns

๏ ESB listens to a JMS queue๏ JMS client can place a message in JMS queue๏ ESB picks message from JMS queue and process further๏ ESB does not need to be active/running to client to produce

messages

ESB as JMS Consumer

Page 17: Understanding JMS Integration Patterns

๏ Client sends a message to ESB using synchronous transport like (HTTP)

๏ ESB puts message to a JMS queue and ack to HTTT client๏ JMS consumer ( backend ) listens to JMS queue and picks

message๏ ESB can produce messages to backend regardless of it’s active or

not

ESB as JMS Producer

Page 18: Understanding JMS Integration Patterns

๏ Combination of previous two patterns๏ Both ESB and Backend can go offline without breaking message

flow

ESB as both JMS Consumer and Producer

Page 19: Understanding JMS Integration Patterns

๏ Client sends a message to ESB using a synchronous transport (HTTP)

๏ ESB sends a JMS message to request queue with JMSReplyTo header set to response queue

๏ Backend reads message from request queue and place response to response queue (by checking JMSReplyTo header)

๏ JMS correlation ID of response = message ID of request

JMS Synchronous Invocations

Page 20: Understanding JMS Integration Patterns

๏ ESB picks matching response from response queue by reading JMS message which has correct correlation ID (ESB uses a JMS message selector to perform this)

๏ Finally response if forwarded back to client๏ http://docs.oracle.com/cd/E19798-01/821-1841/bncer/index.

html

JMS Synchronous Invocations

Page 21: Understanding JMS Integration Patterns

๏ Using synchronous JMS invocations in both client and server side๏ Using synchronous JMS are NOT encouraged because it’s no

longer time decoupled

JMS Synchronous Invocations (Quad Channel)

Page 22: Understanding JMS Integration Patterns

๏ Subscribers subscribed to topic in JMS broker๏ Client sends a message to ESB๏ ESB forwards message to topic๏ Message broker delivers message to all subscribers

Publish Subscribe with JMS

Client ESB

Topic

Subscriber

Subscriber

Subscriber

Page 23: Understanding JMS Integration Patterns

๏ Multiple ESB nodes subscribed to topic in JMS broker๏ Client sends a message to ESB๏ ESB forwards message to topic๏ Message broker delivers message subscribed ESB nodes

Publish Subscribe Multiple ESBs

Client ESB

Topic

ESB

ESB

ESB

Page 24: Understanding JMS Integration Patterns

๏ JMS Message Store๏ Intermediate persistent storage of messages

๏ A store works with a processor๏ Message Processor

๏ Sampling processor๏ Message Forwarding processor

๏ Provides store and forward messaging within the ESB๏ Can be used to implement

๏ Guaranteed Delivery, Request Rate Matching, In Order Delivery, and Separation of Concerns

Message Store and Processor

Page 25: Understanding JMS Integration Patterns

Matching Request Rates

๏ Client and Service have two different/varying rate limits for sending and accepting messages respectively

๏ ESB does rate matching๏ JMS message store provides Storage

Message Store and Processor

Page 26: Understanding JMS Integration Patterns

Guaranteed Delivery

๏ JMS message store acting as a Dead Letter Channel

Message Store and Processor

Page 27: Understanding JMS Integration Patterns

In-Order Delivery

๏ JMS message store acting as a FIFO Queue

Message Store and Processor

(3) Send/Retry on failure

Page 28: Understanding JMS Integration Patterns

Separation of Concerns

๏ Most common use of a message store

Message Store and Processor

Page 29: Understanding JMS Integration Patterns

๏ Create JMS Listeners dynamically without changing axis2.xml and server restart

๏ Support JMS protocol in tenants๏ Distributed coordination

๏ Run in all/one node

Inbound Endpoint with Upcoming WSO2 ESB 4.9.0

Page 30: Understanding JMS Integration Patterns

๏ MQTT is light weight publish/subscribe protocol๏ Ideal for mobile devices/IoT because of small footprint๏ Latest WSO2 ESB supports connecting to MQTT broker ๏ Upcoming WSO2 MB can act as a MQTT broker

MQTT

Page 31: Understanding JMS Integration Patterns

๏ Distributed publish-subscribe messaging system๏ WSO2 ESB 4.9.0 will support connecting to Apache Kafka๏ Kafka Inbound endpoint ( consumer )๏ Kafka Connector ( producer )

Apache Kafka

Page 32: Understanding JMS Integration Patterns

*

๏ WSO2 ESB http://wso2.com/products/enterprise-service-bus

๏ WSO2 ESB Documentationhttps://docs.wso2.

org/display/ESB481/WSO2+Enterprise+Service+Bus+Documentation

6

Links

Page 33: Understanding JMS Integration Patterns

**

Business Model

Page 34: Understanding JMS Integration Patterns

Contact us !