Sample 251: Switching from HTTP/S to JMS
<definitions xmlns="http://ws.apache.org/ns/synapse">
<proxy name="StockQuoteProxy" transports="http">
<target>
<endpoint>
<address
uri="jms:/SimpleStockQuoteService?transport.jms.ConnectionFactoryJNDIName=QueueConnectionFactory&java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory&java.naming.provider.url=tcp://localhost:61616&transport.jms.DestinationType=queue"/>
</endpoint>
<inSequence>
<property action="set" name="OUT_ONLY" value="true"/>
</inSequence>
<outSequence>
<send/>
</outSequence>
</target>
<publishWSDL uri="file:repository/conf/sample/resources/proxy/sample_proxy_1.wsdl"/>
</proxy>
</definitions>
Objective
This sample demonstrates receiving messages over HTTP/S and forwarding them to
a JMS queue
Executing the Client
This Synapse configuration creates a proxy service over HTTP and forwards
received messages to a JMS queue. To test this functionality, send a place order
request to Synapse over HTTP as follows.
ant stockquote -Daddurl=http://localhost:8280/services/StockQuoteProxy -Dmode=placeorder -Dsymbol=MSFT
Note that the target endpoint of the proxy service points to a JMS queue in the
ActiveMQ broker.
jms:/SimpleStockQuoteService?transport.jms.ConnectionFactoryJNDIName=
QueueConnectionFactory&java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory&
java.naming.provider.url=tcp://localhost:61616
The sample Axis2 server will pick up the message from the JMS queue and print the
following log entry.
Accepted order for : 18406 stocks of MSFT at $ 83.58806051152119
Back to Catalog