Search code examples
jmsactivemq-classicapache-camelstomp

Camel ActiveMQComponent when using other than openwire protocols


Following the guidelines on activemq.apache.org it's fairly easy to get up and running using openwire as transport protocol.

Letting the URI have the trace option, lets you see the handshaking and all: @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]}

However, when doing stomp (or any amqp for that matter).

Changing the URI to @testing.activeMqInstance=failover:stomp://localhost:61612?trace=true just seems to establish the connection (socket), and not start the protocol:

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]

Anybody have any insight into why there's no activity on the transport? Got the same trace option on in the broker, but no TRACE logging occurs telling me that the client (ActiveMQComponent) doesn't event send the first CONNECT frame.

For reference, the component is configured using 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"/>

Any input is appreciated! :-)


Solution

  • The ActiveMQ JMS client only supports the Openwire protocol.

    If you want to use STOMP, I'd recommend the stompjms client from https://github.com/fusesource/stompjms

    If you want to use AMQP, use the AMQP 1.0 JMS client from the Apache Qpid project