How to use JMS Outbound
endpoint
14-05-2015
Abstract
• The main motto of this PPT is How to use JMS
outbound endpoint in our applications.
Introduction
• JMS (Java Message Service) is a widely-used
API for Message Oriented Middleware. It
allows communication between different
components of a distributed application to be
loosely coupled, reliable, and asynchronous.
Example
.mflow
• <?xml version="1.0" encoding="UTF-8"?>
•
• <mule xmlns:http="http://www.mulesoft.org/schema/mule/http"
xmlns="http://www.mulesoft.org/schema/mule/core"
xmlns:doc="http://www.mulesoft.org/schema/mule/documentation"
• xmlns:spring="http://www.springframework.org/schema/beans"
• xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
• xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-current.xsd
• http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd
• http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd">
• <http:listener-config name="HTTP_Listener_Configuration" host="0.0.0.0" port="8088" doc:name="HTTP
Listener Configuration"/>
• <jms:activemq-connector name="Active_MQ" brokerURL="tcp://localhost:61616" validateConnections="true"
doc:name="Active MQ"/>
• <flow name="readingjsonFlow">
• <http:listener config-ref="HTTP_Listener_Configuration" path="/" doc:name="HTTP"/>
• <logger message="--flow started" level="INFO" doc:name="Logger"/>
• <set-payload value="{ &quot;Address&quot;:{ &quot;Country&quot;:&quot;India&quot;,
&quot;State&quot;:&quot;AP&quot;, &quot;City&quot;:&quot;Rajhamundry&quot; } }" doc:name="Set Payload"/>
• <jms:outbound-endpoint queue="myqueue" connector-ref="Active_MQ" doc:name="JMS"/>
• </flow>
• </mule>
• Output:
• INFO 2016-05-06 17:35:37,492 [main] org.mule.module.launcher.MuleDeploymentService:
• ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
• + Started app 'JSONOutbound' +
• ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
• INFO 2016-05-06 17:35:38,806 [main] org.mule.module.launcher.DeploymentDirectoryWatcher:
• ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
• + Mule is up and kicking (every 5000ms) +
• ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
• INFO 2016-05-06 17:35:40,680 [main] org.mule.module.launcher.StartupSummaryDeploymentListener:
• **********************************************************************
• * - - + DOMAIN + - - * - - + STATUS + - - *
• **********************************************************************
• * default * DEPLOYED *
• **********************************************************************
•
• *******************************************************************************************************
• * - - + APPLICATION + - - * - - + DOMAIN + - - * - - + STATUS + - - *
• *******************************************************************************************************
• * JSONOutbound * default * DEPLOYED *
• *******************************************************************************************************
•
• INFO 2016-05-06 17:37:59,932 [[JSONOutbound].HTTP_Listener_Configuration.worker.01] org.mule.api.processor.LoggerMessageProcessor: --flow
started
• INFO 2016-05-06 17:38:00,542 [[JSONOutbound].HTTP_Listener_Configuration.worker.01]
org.mule.transport.service.DefaultTransportServiceDescriptor: Loading default outbound transformer:
org.mule.transport.jms.transformers.ObjectToJMSMessage
• INFO 2016-05-06 17:38:00,542 [[JSONOutbound].HTTP_Listener_Configuration.worker.01]
org.mule.transport.service.DefaultTransportServiceDescriptor: Loading default response transformer:
org.mule.transport.jms.transformers.ObjectToJMSMessage
• WARN 2016-05-06 17:38:00,542 [[JSONOutbound].HTTP_Listener_Configuration.worker.01]
com.mulesoft.mule.transport.jms.EeJmsMessageDispatcher: Starting patched JmsMessageReceiver
• INFO 2016-05-06 17:38:00,542 [[JSONOutbound].HTTP_Listener_Configuration.worker.01] org.mule.lifecycle.AbstractLifecycleManager: Initialising:
'Active_MQ.dispatcher.1236527945'. Object is: EeJmsMessageDispatcher
• INFO 2016-05-06 17:38:00,557 [[JSONOutbound].HTTP_Listener_Configuration.worker.01] org.mule.lifecycle.AbstractLifecycleManager: Starting:
'Active_MQ.dispatcher.1236527945'. Object is: EeJmsMessageDispatcher
• Flow of execution:
1. URL to trigger the service from browser
http://localhost:8088
2. JMS outbound endpoint pushes the payload
(setpayload) to “myqueue”.
References
• https://docs.mulesoft.com/mule-user-
guide/v/3.6/jms-transport-reference

How to use jms outbound endpoint

  • 1.
    How to useJMS Outbound endpoint 14-05-2015
  • 2.
    Abstract • The mainmotto of this PPT is How to use JMS outbound endpoint in our applications.
  • 3.
    Introduction • JMS (JavaMessage Service) is a widely-used API for Message Oriented Middleware. It allows communication between different components of a distributed application to be loosely coupled, reliable, and asynchronous.
  • 4.
  • 5.
    .mflow • <?xml version="1.0"encoding="UTF-8"?> • • <mule xmlns:http="http://www.mulesoft.org/schema/mule/http" xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:doc="http://www.mulesoft.org/schema/mule/documentation" • xmlns:spring="http://www.springframework.org/schema/beans" • xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" • xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-current.xsd • http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd • http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd"> • <http:listener-config name="HTTP_Listener_Configuration" host="0.0.0.0" port="8088" doc:name="HTTP Listener Configuration"/> • <jms:activemq-connector name="Active_MQ" brokerURL="tcp://localhost:61616" validateConnections="true" doc:name="Active MQ"/> • <flow name="readingjsonFlow"> • <http:listener config-ref="HTTP_Listener_Configuration" path="/" doc:name="HTTP"/> • <logger message="--flow started" level="INFO" doc:name="Logger"/> • <set-payload value="{ &quot;Address&quot;:{ &quot;Country&quot;:&quot;India&quot;, &quot;State&quot;:&quot;AP&quot;, &quot;City&quot;:&quot;Rajhamundry&quot; } }" doc:name="Set Payload"/> • <jms:outbound-endpoint queue="myqueue" connector-ref="Active_MQ" doc:name="JMS"/> • </flow> • </mule>
  • 6.
    • Output: • INFO2016-05-06 17:35:37,492 [main] org.mule.module.launcher.MuleDeploymentService: • ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ • + Started app 'JSONOutbound' + • ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ • INFO 2016-05-06 17:35:38,806 [main] org.mule.module.launcher.DeploymentDirectoryWatcher: • ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ • + Mule is up and kicking (every 5000ms) + • ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ • INFO 2016-05-06 17:35:40,680 [main] org.mule.module.launcher.StartupSummaryDeploymentListener: • ********************************************************************** • * - - + DOMAIN + - - * - - + STATUS + - - * • ********************************************************************** • * default * DEPLOYED * • ********************************************************************** • • ******************************************************************************************************* • * - - + APPLICATION + - - * - - + DOMAIN + - - * - - + STATUS + - - * • ******************************************************************************************************* • * JSONOutbound * default * DEPLOYED * • ******************************************************************************************************* • • INFO 2016-05-06 17:37:59,932 [[JSONOutbound].HTTP_Listener_Configuration.worker.01] org.mule.api.processor.LoggerMessageProcessor: --flow started • INFO 2016-05-06 17:38:00,542 [[JSONOutbound].HTTP_Listener_Configuration.worker.01] org.mule.transport.service.DefaultTransportServiceDescriptor: Loading default outbound transformer: org.mule.transport.jms.transformers.ObjectToJMSMessage • INFO 2016-05-06 17:38:00,542 [[JSONOutbound].HTTP_Listener_Configuration.worker.01] org.mule.transport.service.DefaultTransportServiceDescriptor: Loading default response transformer: org.mule.transport.jms.transformers.ObjectToJMSMessage • WARN 2016-05-06 17:38:00,542 [[JSONOutbound].HTTP_Listener_Configuration.worker.01] com.mulesoft.mule.transport.jms.EeJmsMessageDispatcher: Starting patched JmsMessageReceiver • INFO 2016-05-06 17:38:00,542 [[JSONOutbound].HTTP_Listener_Configuration.worker.01] org.mule.lifecycle.AbstractLifecycleManager: Initialising: 'Active_MQ.dispatcher.1236527945'. Object is: EeJmsMessageDispatcher • INFO 2016-05-06 17:38:00,557 [[JSONOutbound].HTTP_Listener_Configuration.worker.01] org.mule.lifecycle.AbstractLifecycleManager: Starting: 'Active_MQ.dispatcher.1236527945'. Object is: EeJmsMessageDispatcher
  • 7.
    • Flow ofexecution: 1. URL to trigger the service from browser http://localhost:8088 2. JMS outbound endpoint pushes the payload (setpayload) to “myqueue”.
  • 9.