Wso2 esb JMS 使用 ActiveMQ 消费和生成消息

Wso2 esb JMS consume and produce message with ActiveMQ

您好,我正在使用 WSO2 ESB 4.7.0

我创建了一个代理,它侦听一个 jms 队列并使用来自该队列的消息并将其放置在另一个 jms 队列中,下面是我的代理代码。

    <proxy xmlns="http://ws.apache.org/ns/synapse"
       name="DLQ.kumar"
       transports="jms"
       startOnLoad="true"
       trace="disable">
   <target>
      <inSequence>
         <property name="OUT_ONLY" value="true"/>
         <send>
            <endpoint>
                  <address uri="jms:/kumar?transport.jms.ConnectionFactoryJNDIName=QueueConnectionFactory&amp;  java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory&amp;java.naming.provider.url=tcp://localhost:61616"/>
               </endpoint>
         </send>
    <property name="FORCE_SC_ACCEPTED" value="true" scope="axis2"/>
         <log level="full"/>
      </inSequence>
   </target>
</proxy>

根据流程,它应该读取来自 DLQ.kumar 的消息并将该消息放入 kumar,但是它正在读取来自 DLQ.kumar 的消息并且无法将其放入 kumar。

我的 ESB 正在反映流动错误

    JMSUtils Cannot locate destination : Kumar
    [2015-08-04 13:09:51,265] ERROR - JMSOutTransportInfo Couldn't locate the JMS destination Kumar of type generic extracted from the URL jms:/Kumar?transport.jms.ConnectionFactoryJNDIName=QueueConnectionFactory&                 java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory&java.naming.provider.url=tcp://localhost:61616
    javax.naming.NameNotFoundException: Name [dynamicQueues/Kumar] is not bound in this Context. Unable to find [dynamicQueues].
        at org.apache.naming.NamingContext.lookup(NamingContext.java:820)
        at org.apache.naming.NamingContext.lookup(NamingContext.java:168)
        at org.wso2.carbon.context.internal.CarbonContextDataHolder$CarbonInitialJNDIContext.lookup(CarbonContextDataHolder.java:1030)
        at javax.naming.InitialContext.lookup(InitialContext.java:409)
        at org.apache.axis2.transport.jms.JMSUtils.lookup(JMSUtils.java:583)
        at org.apache.axis2.transport.jms.JMSUtils.lookupDestination(JMSUtils.java:814)
        at org.apache.axis2.transport.jms.JMSOutTransportInfo.getDestination(JMSOutTransportInfo.java:184)
        at org.apache.axis2.transport.jms.JMSOutTransportInfo.loadConnectionFactoryFromProperties(JMSOutTransportInfo.java:132)
        at org.apache.axis2.transport.jms.JMSOutTransportInfo.createJMSSender(JMSOutTransportInfo.java:330)
        at org.apache.axis2.transport.jms.JMSSender.sendMessage(JMSSender.java:125)
        at org.apache.axis2.transport.base.AbstractTransportSender.invoke(AbstractTransportSender.java:112)
        at org.apache.axis2.engine.AxisEngine$TransportNonBlockingInvocationWorker.run(AxisEngine.java:626)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1146)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
        at java.lang.Thread.run(Thread.java:701)
    [2015-08-04 13:09:51,266]  INFO - AxisEngine [MessageContext: logID=93b40feadaf9ce3b4ef4eb0952395ebbfd2b79b95d9bd0fa] Couldn't locate the JMS destination Kumar of type generic extracted from the URL jms:/Kumar?transport.jms.ConnectionFactoryJNDIName=QueueConnectionFactory&                 java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory&java.naming.provider.url=tcp://localhost:61616
     INFO - AxisEngine [MessageContext: logID=93b40feadaf9ce3b4ef4eb0952395ebbfd2b79b95d9bd0fa] Couldn't locate the JMS destination Kumar of type generic extracted from the URL jms:/Kumar?transport.jms.ConnectionFactoryJNDIName=QueueConnectionFactory&                 java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory&java.naming.provider.url=tcp://localhost:61616
[2015-08-04 13:09:51,266] ERROR - AsyncCallback Couldn't locate the JMS destination Kumar of type generic extracted from the URL jms:/Kumar?transport.jms.ConnectionFactoryJNDIName=QueueConnectionFactory&                 java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory&java.naming.provider.url=tcp://localhost:61616
org.apache.axis2.transport.jms.AxisJMSException: Couldn't locate the JMS destination Kumar of type generic extracted from the URL jms:/Kumar?transport.jms.ConnectionFactoryJNDIName=QueueConnectionFactory&                 java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory&java.naming.provider.url=tcp://localhost:61616
    at org.apache.axis2.transport.jms.JMSOutTransportInfo.handleException(JMSOutTransportInfo.java:250)
    at org.apache.axis2.transport.jms.JMSOutTransportInfo.getDestination(JMSOutTransportInfo.java:186)
    at org.apache.axis2.transport.jms.JMSOutTransportInfo.loadConnectionFactoryFromProperties(JMSOutTransportInfo.java:132)
    at org.apache.axis2.transport.jms.JMSOutTransportInfo.createJMSSender(JMSOutTransportInfo.java:330)
    at org.apache.axis2.transport.jms.JMSSender.sendMessage(JMSSender.java:125)
    at org.apache.axis2.transport.base.AbstractTransportSender.invoke(AbstractTransportSender.java:112)
    at org.apache.axis2.engine.AxisEngine$TransportNonBlockingInvocationWorker.run(AxisEngine.java:626)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1146)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at java.lang.Thread.run(Thread.java:701)
Caused by: javax.naming.NameNotFoundException: Name [dynamicQueues/Kumar] is not bound in this Context. Unable to find [dynamicQueues].
    at org.apache.naming.NamingContext.lookup(NamingContext.java:820)
    at org.apache.naming.NamingContext.lookup(NamingContext.java:168)
    at org.wso2.carbon.context.internal.CarbonContextDataHolder$CarbonInitialJNDIContext.lookup(CarbonContextDataHolder.java:1030)
    at javax.naming.InitialContext.lookup(InitialContext.java:409)
    at org.apache.axis2.transport.jms.JMSUtils.lookup(JMSUtils.java:583)
    at org.apache.axis2.transport.jms.JMSUtils.lookupDestination(JMSUtils.java:814)
    at org.apache.axis2.transport.jms.JMSOutTransportInfo.getDestination(JMSOutTransportInfo.java:184)
    ... 8 more
[2015-08-04 13:09:51,267]  WARN - AsyncCallback Executing fault handler due to exception encountered
[2015-08-04 13:09:51,267]  WARN - EndpointContext Endpoint : endpoint_b1b40feadaf9ce3b4767fa0952395ebba03b79b95d9bd0fa will be marked SUSPENDED as it failed

谢谢!!

您是否通过取消注释 $ESB_HOME/repository/conf/axis2/axis2.xml 文件中的以下配置来配置 JMS 传输发送器?如果没有,请配置它并重新启动 ESB。

<transportSender name="jms" class="org.apache.axis2.transport.jms.JMSSender"/>
<endpoint>
     <address uri="jms:/dynamicQueues/kumar?transport.jms.ConnectionFactoryJNDIName=KumarQueueConnectionFactory&amp;java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory&amp;java.naming.provider.url=tcp://localhost:61616&amp;transport.jms.DestinationType=queue/>
</endpoint>

或者您将连接工厂定义为 axis2.xml 并使用此 uri:jms:/dynamicQueues/kumar?transport.jms.ConnectionFactory=myQueueConnectionFactory