fusesource / stompjms

The JMS interface to STOMP
Other
46 stars 27 forks source link

StompJmsDurableTopicSubscriber not registering as durable subscriber on ActiveMQ 5.8.0 from Camel. #9

Open jhberges opened 11 years ago

jhberges commented 11 years ago

I can see in the debugger that it is StompJmsDurableTopicSubscriber that is used, and the TRACE level logging on the stomp connector in ActiveMQ yields:

2013-02-13 12:45:25,737 | TRACE | Sending: 
CONNECTED
heart-beat:0,0
session:ID:8100-007-1502-1360754670225-2:33
server:ActiveMQ/5.8.0
version:1.1

2013-02-13 12:45:25,752 | TRACE | Received: 
SUBSCRIBE
ack:client
receipt:2
destination:/topic/blabla.topic
id:1
persistent:true

Spring configuration:

<bean id="stomper" class="org.apache.camel.component.jms.JmsComponent">
    <property name="connectionFactory" ref="stompConnectionFactory" />
</bean>

<bean id="stompConnectionFactory" class="org.fusesource.stomp.jms.StompJmsConnectionFactory">
    <property name="brokerURI" value="${activeMqInstance}"/>
    <property name="username" value="${activeMqUsername}"/>
    <property name="password" value="${activeMqPassword}"/>
</bean>

And the "activeMqInstance" variable is set to:

tcp://localhost:61613

(i.e "stomp+nio")

The Camel consumer is declared as:

<camel:from uri="stomper:topic:blabla.topic?clientId=stomper-blabla&amp;durableSubscriptionName=stomper-blabla"/>

The result is that the "stomper-blabla" consumer is connected as an ephemeral consumer, and does not assume the role of the configured durable one.

chirino commented 11 years ago

Yep. that's a problem. I've just committed a change so that the client detects that you are talking to ActiveMQ and sends the right headers for ActiveMQ on the subscribe frame. Try out the new 1.14-SNAPSHOT and let now if that works better for you.

jhberges commented 11 years ago

Thanks for the reply!

Tried 1.14-SNAPSHOT from "Fusesource Snapshots", with the same setup as above. This is what was logged by the wireFormat TRACE logging:

2013-02-14 08:38:01,857 | TRACE | Received: 
CONNECT
host:localhost
accept-version:1.1
client-id:stomper-blabla
passcode:*****
login:app_blabla

2013-02-14 08:38:01,857 | DEBUG | Stomp Inactivity Monitor read check: 0, write check: 0 | org.apache.activemq.transport.stomp.StompInactivityMonitor | ActiveMQ NIO Worker 2
2013-02-14 08:38:01,857 | DEBUG | Stomp Connect heartbeat conf RW[0,0] | org.apache.activemq.transport.stomp.ProtocolConverter | ActiveMQ NIO Worker 2
2013-02-14 08:38:01,873 | TRACE | Sending: 
CONNECTED
heart-beat:0,0
session:stomper-blabla
server:ActiveMQ/5.8.0
version:1.1

2013-02-14 08:38:01,888 | TRACE | Received: 
SUBSCRIBE
activemq.subscriptionName:1
ack:client
receipt:2
destination:/topic/blabla.topic
id:1

2013-02-14 08:38:01,888 | TRACE | Sending: 
RECEIPT
receipt-id:2

Seems like a discrepancy between "client-id" header in the "CONNECT" frame and the "activemq.subscriptionName" header in the "SUBSCRIBE" frame? (ref http://activemq.apache.org/stomp.html#Stomp-ActiveMQextensionstoStomp)

Without diving too deep into it, I note that the StompJmsSession class on line 381 feeds the StompJmsTopicSubscriber an id from "getChannel().nextId()" - which sounds like a sequencer?

Thanks // JHB