遵循 activemq.apache.org 上的指南,使用 openwire 作为传输协议很容易启动和运行。
让 URI 有trace
选项,让你看到握手和所有:@testing.activeMqInstance=failover:tcp://localhost:61616?trace=true
09:36:06.764 [ActiveMQ Task-1] DEBUG o.a.a.t.failover.FailoverTransport - Attempting 0th connect to: tcp://localhost:61616?trace=true
09:36:06.780 [ActiveMQ Task-1] DEBUG o.a.a.transport.WireFormatNegotiator - Sending: WireFormatInfo { version=9, properties={MaxFrameSize=9223372036854775807, CacheSize=1024, CacheEnabled=true, SizePrefixDisabled=false, MaxInactivityDurationInitalDelay=10000, TcpNoDelayEnabled=true, MaxInactivityDuration=30000, TightEncodingEnabled=true, StackTraceEnabled=true}, magic=[A,c,t,i,v,e,M,Q]}
09:36:06.780 [ActiveMQ Task-1] DEBUG o.a.a.t.TransportLogger.Connection:2 - SENDING: WireFormatInfo { version=9, properties={MaxFrameSize=9223372036854775807, CacheSize=1024, CacheEnabled=true, SizePrefixDisabled=false, MaxInactivityDurationInitalDelay=10000, TcpNoDelayEnabled=true, MaxInactivityDuration=30000, TightEncodingEnabled=true, StackTraceEnabled=true}, magic=[A,c,t,i,v,e,M,Q]}
09:36:06.780 [ActiveMQ Task-1] DEBUG o.a.a.t.failover.FailoverTransport - Connection established
09:36:06.780 [ActiveMQ Task-1] INFO o.a.a.t.failover.FailoverTransport - Successfully connected to tcp://localhost:61616?trace=true
09:36:06.780 [ActiveMQ Transport: tcp://localhost/127.0.0.1:61616@4060] DEBUG o.a.a.t.TransportLogger.Connection:2 - RECEIVED: WireFormatInfo { version=9, properties={CacheSize=1024, MaxFrameSize=9223372036854775807, CacheEnabled=true, SizePrefixDisabled=false, TcpNoDelayEnabled=true, MaxInactivityDurationInitalDelay=10000, MaxInactivityDuration=30000, TightEncodingEnabled=true, StackTraceEnabled=true}, magic=[A,c,t,i,v,e,M,Q]}
但是,在进行 stomp (或任何 amqp )时。
将 URI 更改为@testing.activeMqInstance=failover:stomp://localhost:61612?trace=true
似乎只是建立连接(套接字),而不是启动协议:
09:37:07.444 [ActiveMQ Task-1] DEBUG o.a.a.t.failover.FailoverTransport - urlList connectionList:[stomp://localhost:61612?trace=true], from: [stomp://localhost:61612?trace=true]
09:37:07.444 [ActiveMQ Task-1] DEBUG o.a.a.t.failover.FailoverTransport - Attempting 0th connect to: stomp://localhost:61612?trace=true
09:37:07.444 [ActiveMQ Task-1] DEBUG o.a.a.t.failover.FailoverTransport - Connection established
09:37:07.444 [ActiveMQ Task-1] INFO o.a.a.t.failover.FailoverTransport - Successfully connected to stomp://localhost:61612?trace=true
[silence]
有人知道为什么运输上没有活动吗?trace
在代理中获得了相同的选项,但没有TRACE
发生日志记录告诉我客户端(ActiveMQComponent)没有事件发送第一CONNECT
帧。
作为参考,该组件是使用 Spring xml 配置的:
<bean id="jmsActiveMqConnectionFactory"
class="org.apache.activemq.ActiveMQConnectionFactory">
<property name="brokerURL" value="${activeMqInstance}" />
<property name="userName" value="${activeMqUsername}"/>
<property name="password" value="${activeMqPassword}"/>
</bean>
<bean id="pooledActiveMqConnectionFactory"
class="org.apache.activemq.pool.PooledConnectionFactory" init-method="start" destroy-method="stop">
property name="maxConnections" value="8" />
<property name="connectionFactory" ref="jmsActiveMqConnectionFactory" />
</bean>
<bean id="jmsActiveMqConfig"
class="org.apache.camel.component.jms.JmsConfiguration">
<property name="connectionFactory" ref="pooledActiveMqConnectionFactory"/>
<property name="concurrentConsumers" value="1"/>
</bean>
<bean id="activemq"
class="org.apache.activemq.camel.component.ActiveMQComponent">
<property name="configuration" ref="jmsActiveMqConfig"/>
任何输入表示赞赏!:-)