Pergunta

I have a service listening on a queue that I want to forward the message to a totally different broker. Is this possible in WSO2 ESB and if so how would this configuration be done? I tried specifying the endpoint using the other broker's transport url but that did not work...

Foi útil?

Solução

Here's the WSO2 ESB proxy service configuration I've used to pick from a JMS queue and post to another queue (on an ActiveMQ JMS provider):

<proxy xmlns="http://ws.apache.org/ns/synapse" name="JMS_to_JMS_proxy_service" transports="jms" statistics="disable" trace="disable" startOnLoad="true">
   <target>
      <inSequence>
         <log level="full" separator="," />
         <property name="OUT_ONLY" value="true" scope="default" type="STRING" />
         <send>
            <endpoint>
               <address uri="jms:/Destination_Queue_Name?transport.jms.ConnectionFactoryJNDIName=QueueConnectionFactory&amp;java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory&amp;java.naming.provider.url=tcp://Your_Host:61616&amp;transport.jms.DestinationType=queue" trace="disable">
                  <timeout>
                     <duration>30000</duration>
                     <responseAction>fault</responseAction>
                  </timeout>
                  <suspendOnFailure>
                     <initialDuration>0</initialDuration>
                     <progressionFactor>1.0</progressionFactor>
                     <maximumDuration>0</maximumDuration>
                  </suspendOnFailure>
               </address>
            </endpoint>
         </send>
      </inSequence>
   </target>
   <parameter name="transport.jms.ContentType">
      <rules>                              
         <jmsProperty>contentType</jmsProperty>                              
         <default>text/plain; charset=ISO-8859-1</default>                    
      </rules>
   </parameter>
   <parameter name="transport.jms.ConnectionFactory">myQueueConnectionFactory</parameter>
   <parameter name="transport.jms.DestinationType">queue</parameter>
   <parameter name="transport.jms.Destination">Source_Queue_Name</parameter>
</proxy>                                

Don't forget to enable the JMS Transport Sender under Configure -> Transports menu. Also the myQueueConnectionFactory refers to a parameter set under Configure -> Transports -> JMS Transport Listener.

Update: Newer versions of WSO2 ESB will not have a GUI option to enable/disable transports. To do so, you will have to modify the {ESB_ROOT_DIRECTORY}/repository/conf/axis2/axis2.xml file and un-comment the JMSListener/JMSSender that corresponds to your environment (ActiveMQ, WSO2 MB, etc.)

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top