我有一个持久订阅 ActiveMQ 的 JMS 代理,在 WSO2 ESB v4.5.1 和 v4.7 中完美运行
我正在尝试在 WSO2 ESB v4.8.0(里程碑 3 或 4)中使用它但没有成功
在启动 ESB 之前,没有在 ActiveMQ 中定义主题并且没有引用持久订阅者(ActiveMQ 控制台中的 0 个离线订阅者)
ESB 中的 JMS 代理:
<proxy xmlns="http://ws.apache.org/ns/synapse" name="TestJMSProxy" transports="jms" startOnLoad="true" trace="disable">
<target>
<inSequence>
<log level="full"/>
</inSequence>
<outSequence/>
<faultSequence/>
</target>
<parameter name="transport.jms.ContentType">
<rules>
<jmsProperty>contentType</jmsProperty>
<default>text/xml</default>
</rules>
</parameter>
<parameter name="transport.jms.ConnectionFactory">myTopicConnectionFactory</parameter>
<parameter name="transport.jms.DestinationType">topic</parameter>
<parameter name="transport.jms.SubscriptionDurable">true</parameter>
<parameter name="transport.jms.Destination">MY_TOPIC</parameter>
<parameter name="transport.jms.DurableSubscriberName">TestJMSProxy</parameter>
<parameter name="transport.jms.CacheLevel">consumer</parameter>
<parameter name="transport.jms.DurableSubscriberClientID">1</parameter>
</proxy>
/repository/conf/axis2/axis2.xml 中的 JMS 配置:
<transportReceiver name="jms" class="org.apache.axis2.transport.jms.JMSListener">
<parameter name="myTopicConnectionFactory" locked="false">
<parameter name="java.naming.factory.initial" locked="false">org.apache.activemq.jndi.ActiveMQInitialContextFactory</parameter>
<parameter name="java.naming.provider.url" locked="false">failover:tcp://localhost:61616</parameter>
<parameter name="transport.jms.ConnectionFactoryJNDIName" locked="false">TopicConnectionFactory</parameter>
<parameter name="transport.jms.ConnectionFactoryType" locked="false">topic</parameter>
</parameter>
<parameter name="myQueueConnectionFactory" locked="false">
<parameter name="java.naming.factory.initial" locked="false">org.apache.activemq.jndi.ActiveMQInitialContextFactory</parameter>
<parameter name="java.naming.provider.url" locked="false">failover:tcp://localhost:61616</parameter>
<parameter name="transport.jms.ConnectionFactoryJNDIName" locked="false">QueueConnectionFactory</parameter>
<parameter name="transport.jms.ConnectionFactoryType" locked="false">queue</parameter>
</parameter>
<parameter name="default" locked="false">
<parameter name="java.naming.factory.initial" locked="false">org.apache.activemq.jndi.ActiveMQInitialContextFactory</parameter>
<parameter name="java.naming.provider.url" locked="false">failover:tcp://localhost:61616</parameter>
<parameter name="transport.jms.ConnectionFactoryJNDIName" locked="false">QueueConnectionFactory</parameter>
<parameter name="transport.jms.ConnectionFactoryType" locked="false">queue</parameter>
</parameter>
</transportReceiver>
--> 我一直在使用具有相同效果的 tcp://localhost:61616 和 nio://localhost:61616
在 ESB 控制台中看到的错误:
TID: [0] [ESB] [2013-10-25 12:04:00,077] ERROR {org.apache.axis2.transport.base.threads.NativeWorkerPool} - Uncaught exception {org.apache.axis2.transport.base.threads.NativeWorkerPool}
org.apache.axis2.transport.jms.AxisJMSException: Error acquiring a JMS connection to : TopicConnectionFactory using JNDI properties : {java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory, serviceType=proxy, transport.jms.ConnectionFactoryType=topic, transport.jms.ConnectionFactory=myTopicConnectionFactory, transport.jms.DestinationType=topic, java.naming.provider.url=failover:tcp://localhost:61616}
at org.apache.axis2.transport.jms.ServiceTaskManager.handleException(ServiceTaskManager.java:1000)
at org.apache.axis2.transport.jms.ServiceTaskManager.access$2500(ServiceTaskManager.java:50)
at org.apache.axis2.transport.jms.ServiceTaskManager$MessageListenerTask.createConnection(ServiceTaskManager.java:830)
at org.apache.axis2.transport.jms.ServiceTaskManager$MessageListenerTask.getConnection(ServiceTaskManager.java:703)
at org.apache.axis2.transport.jms.ServiceTaskManager$MessageListenerTask.receiveMessage(ServiceTaskManager.java:493)
at org.apache.axis2.transport.jms.ServiceTaskManager$MessageListenerTask.run(ServiceTaskManager.java:417)
at org.apache.axis2.transport.base.threads.NativeWorkerPool$1.run(NativeWorkerPool.java:172)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:662)
--> java.lang.OutOfMemoryError 之前的几次:无法创建新的本地线程
在 ActiveMQ 日志中看到的错误:
2013-10-25 12:03:58,905 | WARN | Failed to add Connection ID:JMROUSSEL7-64437-1382695110115-21:1 | org.apache.activemq.broker.TransportConnection | ActiveMQ Transport: tcp:///127.0.0.1:64803@61616
javax.jms.InvalidClientIDException: Broker: localhost - Client: 1 already connected from tcp://127.0.0.1:64802
at org.apache.activemq.broker.region.RegionBroker.addConnection(RegionBroker.java:243)
at org.apache.activemq.broker.BrokerFilter.addConnection(BrokerFilter.java:92)
at org.apache.activemq.advisory.AdvisoryBroker.addConnection(AdvisoryBroker.java:90)
at org.apache.activemq.broker.BrokerFilter.addConnection(BrokerFilter.java:92)
at org.apache.activemq.broker.BrokerFilter.addConnection(BrokerFilter.java:92)
at org.apache.activemq.broker.MutableBrokerFilter.addConnection(MutableBrokerFilter.java:97)
at org.apache.activemq.broker.TransportConnection.processAddConnection(TransportConnection.java:733)
at org.apache.activemq.broker.jmx.ManagedTransportConnection.processAddConnection(ManagedTransportConnection.java:79)
at org.apache.activemq.command.ConnectionInfo.visit(ConnectionInfo.java:139)
at org.apache.activemq.broker.TransportConnection.service(TransportConnection.java:292)
at org.apache.activemq.broker.TransportConnection$1.onCommand(TransportConnection.java:149)
at org.apache.activemq.transport.MutexTransport.onCommand(MutexTransport.java:50)
at org.apache.activemq.transport.WireFormatNegotiator.onCommand(WireFormatNegotiator.java:113)
at org.apache.activemq.transport.AbstractInactivityMonitor.onCommand(AbstractInactivityMonitor.java:270)
at org.apache.activemq.transport.TransportSupport.doConsume(TransportSupport.java:83)
at org.apache.activemq.transport.tcp.TcpTransport.doRun(TcpTransport.java:214)
at org.apache.activemq.transport.tcp.TcpTransport.run(TcpTransport.java:196)
at java.lang.Thread.run(Thread.java:662)
--> 多次
我试过 ActiveMQ 5.7 和 ActiveMQ 5.9,没有区别
您只需在 JMS 代理中更改此行,它就可以在 WSO2 ESB v4.8 中完美运行:<parameter name="transport.jms.SubscriptionDurable">false</parameter>
从队列或消息存储/消息处理器读取的 JMS 代理在 WSO2 ESB 4.8 中完美运行