This section describes how to configure WSO2 Enterprise Integrator (WSO2 EI) to listen to a JMS Queue.
Follow the steps below to configure WSO2 EI to listen to a JMS queue, consume messages, and send them to a HTTP back-end service.
Configure WSO2 EI with Apache ActiveMQ and set up the JMS listener. For instructions, see Configure with ActiveMQ.
Create a proxy service with the following configuration.To create a proxy service using Tooling, see Working with Proxy Services via Tooling.
Proxy Service Configuration
OUT_ONLYproperty is set to true to indicate that message exchange is one-way.
You can make the proxy service a JMS listener by setting its transport as
jms. Once the JMS transport is enabled for a proxy service, WSO2 EI will start listening on a JMS queue with the same name as the proxy service.
In the sample configuration above, WSO2 EI listens to a JMS queue named
JMStoHTTPStockQuoteProxy. To make the proxy service listen to a different JMS queue, define the
transport.jms.Destinationparameter with the name of the destination queue. For details, see below.
- To test this you will need an HTTP back-end service. Deploy the SimpleStockQuoteService and start the Axis2 server.
Place a message into the ActiveMQ queue by executing the following command from
WSO2 EI will read the message from the ActiveMQ queue and send it to the back-end service. You will see the following response in the Axis2 Server console:
Two-way HTTP Back-end Call
In addition to one-way invocations, WSO2 EI proxy service can listen to the queue, pick up a message and do a two-way HTTP call as well. It allows the response to be delivered to a queue specified by the client. This is done by specifying a
ReplyDestination element when placing a request message to a JMS queue. The scenario is depicted in the diagram below.
Note that for two-way JMS scenarios the
OUT_ONLY property is not used.
Use the following command from
<EI_HOME>/samples/axis2Client folder. Note how the
transport.jms.ReplyDestination element is specified.
You can view the responses from the back-end service in
ResponseQueue by accessing the ActiveMQ management console using the URL http://0.0.0.0:8161/admin and using
admin as both the username and password.
Defining Content Type of Incoming JMS Messages
By default, WSO2 EI considers all messages consumed from a queue as a SOAP message. To consider messages consumed from a queue as a different format, define the transport.jms.ContentType parameter with the respective content type as a proxy service parameter.
To demonstrate this, we have modified the above configuration as follows:
Proxy Service Configuration
You can specify a different content type within the
transport.jms.ContentType parameter. In the sample configuration above, the content type defined is
If you want the proxy service to listen to a queue where the queue name is different from the proxy service name, you can specify the queue name using
transport.jms.Destination parameter. In the sample configuration above WSO2 EI listens to a JMS queue named