Address endpoint doesn't support dynamic endpoints. Hence if you want to have dynamic endpoint for your JMS queue, you can use default endpoint together with a "To" header which you can set dynamically. Here is a sample JMS proxy.
The idea behind is that you can set "To" header dynamically and the default endpoint will send the messages out to the endpoint found in "To" header.
<proxy xmlns="http://ws.apache.org/ns/synapse"
name="StockQuoteProxy"
transports="http"
statistics="disable"
trace="disable"
startOnLoad="true">
<target>
<inSequence>
<property name="OUT_ONLY" value="true"/>
<property name="sendToThisQueue" value="SimpleStockQuoteService"/>
<header name="To"
expression="fn:concat('jms:/', get-property('sendToThisQueue'), '?transport.jms.ConnectionFactoryJNDIName=QueueConnectionFactory&java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory&java.naming.provider.url=tcp://localhost:61616')"/>
<send>
<endpoint name="dynamicQueue">
<default>
<timeout>
<duration>300000</duration>
<responseAction>fault</responseAction>
</timeout>
<suspendOnFailure>
<errorCodes>-1</errorCodes>
<initialDuration>0</initialDuration>
<progressionFactor>1.0</progressionFactor>
<maximumDuration>0</maximumDuration>
</suspendOnFailure>
<markForSuspension>
<errorCodes>-1</errorCodes>
</markForSuspension>
</default>
</endpoint>
</send>
</inSequence>
<outSequence>
<send/>
</outSequence>
</target>
<publishWSDL uri="file:repository/samples/resources/proxy/sample_proxy_1.wsdl"/>
<description/>
</proxy>
The idea behind is that you can set "To" header dynamically and the default endpoint will send the messages out to the endpoint found in "To" header.
Address endpoint doesn't support dynamic endpoints. Hence if you want to have dynamic endpoint for your JMS queue, you can use default endpoint together with a "To" header which you can set dynamically. Here is a sample JMS proxy.
No comments:
Post a Comment