...
- Configure WSO2 ESB with Apache ActiveMQ, and set up the JMS listener. For instructions, see Configure with ActiveMQ.
- Start the ESB server.
Anchor | ||||
---|---|---|---|---|
|
Configuring the sample
Create a proxy service with the following configuration. For information on how to create a proxy service, see Creating a Proxy Service.
Code Block language xml <proxy xmlns="http://ws.apache.org/ns/synapse" name="JMStoHTTPStockQuoteProxy" transports="jms"> <target> <inSequence> <property action="set" name="OUT_ONLY" value="true"/> </inSequence> <endpoint> <address uri="http://localhost:9000/services/SimpleStockQuoteService"/> </endpoint> <outSequence> <send/> </outSequence> </target> </proxy>
Tip title Proxy Service ConfigurationTip The
OUT_ONLY
property is set totrue
to indicate that message exchange is one-way.You can make the proxy service a JMS listener by setting the transport as
jms
. Once the JMS transport is enabled for a proxy service, the ESB starts listening on a JMS queue with the same name as the proxy service.If you take a look at the sample configuration above, the ESB listens to a JMS queue named
JMStoHTTPStockQuoteProxy
. To make the proxy service listen to a different JMS queue, define thetransport.jms.Destination
parameter with the name of the destination queue. For details, see below.
Testing the sample
To test this sample, you need an HTTP back-end service. Let's use the SimpleStockQuoteService
as the back-end service and test the sample.
...
Code Block | ||
---|---|---|
| ||
<proxy xmlns="http://ws.apache.org/ns/synapse" name="Proxy1" transports="jms" startOnLoad="true" trace="disable"> <description/> <target> <inSequence> <send> <endpoint> <address uri="http://localhost:9000/services/SimpleStockQuoteService"/> </endpoint> </send> </inSequence> <outSequence> <send/> </outSequence> </target> <parameter name="transport.jms.ContentType"> <rules> <jmsProperty>contentType</jmsProperty> <default>text/xml</default> </rules> </parameter> </proxy> |
Info | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
| ||||||||||
| ||||||||||
In two-way JMS scenarios the Execute the following command from the
You can view the responses from the back-end service in the |
Defining the content type of incoming JMS messages
...
Anchor | ||||
---|---|---|---|---|
|
Tip | ||
---|---|---|
| ||
You can specify a different content type within the 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 the |