You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by Aleksandar Ivanisevic <al...@ivanisevic.de> on 2011/05/27 13:04:23 UTC

STOMP and durable topic subscriptions


Hi,

what is the status on durable topic subscriptions under STOMP? Should
STOMP unsubscribe remove the durable subscription or not?

according to 

http://mail-archives.apache.org/mod_mbox/activemq-users/200808.mbox/%3C19181282.post@talk.nabble.com%3E

and

https://issues.apache.org/jira/browse/AMQ-1890

it should, but in my setup it doesnt, im using 5.4.2-fuse-03-15 and
below is my session, after the last unsubscribe i can still see the
subscription under offline durable subscriptions in the console.

There is even more annoying bug where in some cases (not always),
reconnecting creates a "double" subscription so for every message to
the topic consumer gets two identical messages. The only solution to
that is to either bounce the broker or shutdown the consumer, go to
the console and delete durable subscriptions and start the consumer
again.


[27664] T+0 DEBUG (re)connecting...
send [CONNECT
client-id:adminbroker-test
passcode:xxx
login:xxx

]
receive [CONNECTED
session:adminbroker-test

]
send [SUBSCRIBE
activemq.prefetchSize:5
activemq.subscriptionName:masterbcast
ack:client-individual
destination:/topic/COMMAND.broadcast

]
[27664] T+0 DEBUG subscribed to /topic/COMMAND.broadcast prefetchSize=5 durable name=masterbcast

...

[27664] T+15 DEBUG got exit command, shutting down cleanly...
send [UNSUBSCRIBE
activemq.subscriptionName:masterbcast
destination:/topic/COMMAND.broadcast

]
[27664] T+15 DEBUG unsubscribed from /topic/COMMAND.broadcast durable name=masterbcast
send [DISCONNECT

]

in activemq.log I see

2011-05-27 13:01:07,042 | WARN  | Async error occurred: javax.jms.InvalidDestinationException: No durable subscription exists for: masterbcast | org.apache.activemq.broker.TransportConnection.Service | ActiveMQ Transport: ssl:///192.168.222.78:40678
javax.jms.InvalidDestinationException: No durable subscription exists for: masterbcast
        at org.apache.activemq.broker.region.TopicRegion.removeSubscription(TopicRegion.java:135)
        at org.apache.activemq.broker.region.RegionBroker.removeSubscription(RegionBroker.java:491)
        at org.apache.activemq.broker.BrokerFilter.removeSubscription(BrokerFilter.java:102)
        at org.apache.activemq.broker.BrokerFilter.removeSubscription(BrokerFilter.java:102)


Re: STOMP and durable topic subscriptions

Posted by Aleksandar Ivanisevic <al...@ivanisevic.de>.
Dejan Bosanac <de...@nighttale.net> writes:

> Take a look at StompTest.testDurableUnsub()
>
> https://fisheye6.atlassian.com/browse/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/transport/stomp/StompTest.java?hb=true
>
>
> It contains some example that should work. If it's not working, can you
> please provide a similar test case
> <https://fisheye6.atlassian.com/browse/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/transport/stomp/StompTest.java?hb=true>
> Regards


How sure are you that that test actually passes? I've just done
basically the same thing and I get the exception


[support@2elogger-test ~]$ telnet adminbroker-test 61613
Trying 192.168.222.78...
Connected to adminbroker-test.
Escape character is '^]'.
CONNECT  
client-id:adminbroker-test
passcode:xxx
login:xxx

^@
CONNECTED
session:adminbroker-test


SUBSCRIBE
activemq.prefetchSize:5
activemq.subscriptionName:masterbcast
ack:auto
destination:/topic/COMMAND.broadcast

^@

DISCONNECT
client-id:adminbroker-test

^@
Connection closed by foreign host.
[support@2elogger-test ~]$ telnet adminbroker-test 61613
Trying 192.168.222.78...
Connected to adminbroker-test.
Escape character is '^]'.
CONNECT  
client-id:adminbroker-test
passcode:xxx
login:xxx

^@
CONNECTED
session:adminbroker-test


UNSUBSCRIBE
destination:/topic/COMMAND.broadcast
ack:auto
activemq.subscriptionName:masterbcast

^@
ERROR
message:No durable subscription exists for: masterbcast

javax.jms.InvalidDestinationException: No durable subscription exists for: masterbcast
	at org.apache.activemq.broker.region.TopicRegion.removeSubscription(TopicRegion.java:135)
	at org.apache.activemq.broker.region.RegionBroker.removeSubscription(RegionBroker.java:491)
	at org.apache.activemq.broker.BrokerFilter.removeSubscription(BrokerFilter.java:102)
	at org.apache.activemq.broker.BrokerFilter.removeSubscription(BrokerFilter.java:102)
	at org.apache.activemq.broker.BrokerFilter.removeSubscription(BrokerFilter.java:102)
	at org.apache.activemq.broker.BrokerFilter.removeSubscription(BrokerFilter.java:102)
	at org.apache.activemq.broker.BrokerFilter.removeSubscription(BrokerFilter.java:102)
	at org.apache.activemq.broker.BrokerFilter.removeSubscription(BrokerFilter.java:102)
	at org.apache.activemq.broker.MutableBrokerFilter.removeSubscription(MutableBrokerFilter.java:107)
	at org.apache.activemq.broker.TransportConnection.processRemoveSubscription(TransportConnection.java:345)
	at org.apache.activemq.command.RemoveSubscriptionInfo.visit(RemoveSubscriptionInfo.java:81)
	at org.apache.activemq.broker.TransportConnection.service(TransportConnection.java:310)
	at org.apache.activemq.broker.TransportConnection$1.onCommand(TransportConnection.java:184)
	at org.apache.activemq.transport.TransportFilter.onCommand(TransportFilter.java:69)
	at org.apache.activemq.transport.stomp.StompTransportFilter.sendToActiveMQ(StompTransportFilter.java:81)
	at org.apache.activemq.transport.stomp.ProtocolConverter.sendToActiveMQ(ProtocolConverter.java:140)
	at org.apache.activemq.transport.stomp.ProtocolConverter.onStompUnsubscribe(ProtocolConverter.java:456)
	at org.apache.activemq.transport.stomp.ProtocolConverter.onStompCommand(ProtocolConverter.java:190)
	at org.apache.activemq.transport.stomp.StompTransportFilter.onCommand(StompTransportFilter.java:70)
	at org.apache.activemq.transport.TransportSupport.doConsume(TransportSupport.java:83)
	at org.apache.activemq.transport.tcp.TcpTransport.doRun(TcpTransport.java:222)
	at org.apache.activemq.transport.tcp.TcpTransport.run(TcpTransport.java:204)
	at java.lang.Thread.run(Thread.java:662)

DISCONNECT

^@
Connection closed by foreign host.


[...]



Re: STOMP and durable topic subscriptions

Posted by Dejan Bosanac <de...@nighttale.net>.
Take a look at StompTest.testDurableUnsub()

https://fisheye6.atlassian.com/browse/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/transport/stomp/StompTest.java?hb=true


It contains some example that should work. If it's not working, can you
please provide a similar test case
<https://fisheye6.atlassian.com/browse/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/transport/stomp/StompTest.java?hb=true>
Regards
-- 
Dejan Bosanac - http://twitter.com/dejanb
-----------------
The experts in open source integration and messaging - http://fusesource.com
ActiveMQ in Action - http://www.manning.com/snyder/
Blog - http://www.nighttale.net

Connect at CamelOne <http://camelone.com/> May 24-26

The Open Source Integration Conference



On Fri, May 27, 2011 at 3:46 PM, Aleksandar Ivanisevic <
aleksandar@ivanisevic.de> wrote:

> Timothy Bish <ta...@gmail.com>
> writes:
>
> > Refer to the ActiveMQ documentation on Stomp here:
> > http://activemq.apache.org/stomp.html
> >
> > Note the discussion at the bottom of the page for the subscription name
> > property,
> >
> > "For durable topic subscriptions you must specify the same clientId on
> > the connection and subcriptionName on the subscribe."
>
> I am always supplying the same client-id, it is actually the same
> STOMP session. What I don't understand is how come to create the
> subscription I have to put the durable name in
> activemq.subscriptionName header, but when unsubscribing if I put it
> in the same header i get an exception in amq log, and if I put it in
> the id header (which I found by looking at the sources) it seems
> successful (i.e. no error) but still doesn't work.
>
> Can you (or someone, anyone) please provide an example of subscribing
> and unsubscribing to a durable topic?
>
> >>
> >> [27664] T+0 DEBUG (re)connecting...
> >> send [CONNECT
> >> client-id:adminbroker-test
> >> passcode:xxx
> >> login:xxx
> >>
> >> ]
> >> receive [CONNECTED
> >> session:adminbroker-test
> >>
> >> ]
> >> send [SUBSCRIBE
> >> activemq.prefetchSize:5
> >> activemq.subscriptionName:masterbcast
> >> ack:client-individual
> >> destination:/topic/COMMAND.broadcast
> >>
> >> ]
> >> [27664] T+0 DEBUG subscribed to /topic/COMMAND.broadcast prefetchSize=5
> durable name=masterbcast
> >>
> >> ...
> >>
> >> [27664] T+15 DEBUG got exit command, shutting down cleanly...
> >> send [UNSUBSCRIBE
> >> activemq.subscriptionName:masterbcast
> >> destination:/topic/COMMAND.broadcast
> >>
> >> ]
> >> [27664] T+15 DEBUG unsubscribed from /topic/COMMAND.broadcast durable
> name=masterbcast
> >> send [DISCONNECT
> >>
> >> ]
> >>
> >> in activemq.log I see
> >>
> >> 2011-05-27 13:01:07,042 | WARN  | Async error occurred:
> javax.jms.InvalidDestinationException: No durable subscription exists for:
> masterbcast | org.apache.activemq.broker.TransportConnection.Service |
> ActiveMQ Transport: ssl:///192.168.222.78:40678
> >> javax.jms.InvalidDestinationException: No durable subscription exists
> for: masterbcast
> >>         at
> org.apache.activemq.broker.region.TopicRegion.removeSubscription(TopicRegion.java:135)
> >>         at
> org.apache.activemq.broker.region.RegionBroker.removeSubscription(RegionBroker.java:491)
> >>         at
> org.apache.activemq.broker.BrokerFilter.removeSubscription(BrokerFilter.java:102)
> >>         at
> org.apache.activemq.broker.BrokerFilter.removeSubscription(BrokerFilter.java:102)
> >>
> >
> > --
> > Tim Bish
> > ------------
> > FuseSource
> > Email: tim.bish@fusesource.com
> > Web: http://fusesource.com
> > Twitter: tabish121
> > Blog: http://timbish.blogspot.com/
> >
> > Connect at CamelOne May 24-26
> >
> > The Open Source Integration Conference
> >
> >
>
> --
> Ti si arogantan, prepotentan i peglaš vlastitu frustraciju. -- Ivan
> Tišljar, hr.comp.os.linux
>
>

Re: STOMP and durable topic subscriptions

Posted by Aleksandar Ivanisevic <al...@ivanisevic.de>.
Timothy Bish <ta...@gmail.com>
writes:

> Refer to the ActiveMQ documentation on Stomp here:
> http://activemq.apache.org/stomp.html
>
> Note the discussion at the bottom of the page for the subscription name
> property,
>
> "For durable topic subscriptions you must specify the same clientId on
> the connection and subcriptionName on the subscribe."

I am always supplying the same client-id, it is actually the same
STOMP session. What I don't understand is how come to create the
subscription I have to put the durable name in
activemq.subscriptionName header, but when unsubscribing if I put it
in the same header i get an exception in amq log, and if I put it in
the id header (which I found by looking at the sources) it seems
successful (i.e. no error) but still doesn't work.

Can you (or someone, anyone) please provide an example of subscribing
and unsubscribing to a durable topic?

>> 
>> [27664] T+0 DEBUG (re)connecting...
>> send [CONNECT
>> client-id:adminbroker-test
>> passcode:xxx
>> login:xxx
>> 
>> ]
>> receive [CONNECTED
>> session:adminbroker-test
>> 
>> ]
>> send [SUBSCRIBE
>> activemq.prefetchSize:5
>> activemq.subscriptionName:masterbcast
>> ack:client-individual
>> destination:/topic/COMMAND.broadcast
>> 
>> ]
>> [27664] T+0 DEBUG subscribed to /topic/COMMAND.broadcast prefetchSize=5 durable name=masterbcast
>> 
>> ...
>> 
>> [27664] T+15 DEBUG got exit command, shutting down cleanly...
>> send [UNSUBSCRIBE
>> activemq.subscriptionName:masterbcast
>> destination:/topic/COMMAND.broadcast
>> 
>> ]
>> [27664] T+15 DEBUG unsubscribed from /topic/COMMAND.broadcast durable name=masterbcast
>> send [DISCONNECT
>> 
>> ]
>> 
>> in activemq.log I see
>> 
>> 2011-05-27 13:01:07,042 | WARN  | Async error occurred: javax.jms.InvalidDestinationException: No durable subscription exists for: masterbcast | org.apache.activemq.broker.TransportConnection.Service | ActiveMQ Transport: ssl:///192.168.222.78:40678
>> javax.jms.InvalidDestinationException: No durable subscription exists for: masterbcast
>>         at org.apache.activemq.broker.region.TopicRegion.removeSubscription(TopicRegion.java:135)
>>         at org.apache.activemq.broker.region.RegionBroker.removeSubscription(RegionBroker.java:491)
>>         at org.apache.activemq.broker.BrokerFilter.removeSubscription(BrokerFilter.java:102)
>>         at org.apache.activemq.broker.BrokerFilter.removeSubscription(BrokerFilter.java:102)
>> 
>
> -- 
> Tim Bish
> ------------
> FuseSource
> Email: tim.bish@fusesource.com
> Web: http://fusesource.com
> Twitter: tabish121
> Blog: http://timbish.blogspot.com/
>
> Connect at CamelOne May 24-26
>
> The Open Source Integration Conference
>
>

-- 
Ti si arogantan, prepotentan i peglaš vlastitu frustraciju. -- Ivan
Tišljar, hr.comp.os.linux


Re: STOMP and durable topic subscriptions

Posted by Timothy Bish <ta...@gmail.com>.
On Fri, 2011-05-27 at 13:04 +0200, Aleksandar Ivanisevic wrote:
> 
> Hi,
> 
> what is the status on durable topic subscriptions under STOMP? Should
> STOMP unsubscribe remove the durable subscription or not?
> 
> according to 
> 
> http://mail-archives.apache.org/mod_mbox/activemq-users/200808.mbox/%3C19181282.post@talk.nabble.com%3E
> 
> and
> 
> https://issues.apache.org/jira/browse/AMQ-1890
> 
> it should, but in my setup it doesnt, im using 5.4.2-fuse-03-15 and
> below is my session, after the last unsubscribe i can still see the
> subscription under offline durable subscriptions in the console.
> 
> There is even more annoying bug where in some cases (not always),
> reconnecting creates a "double" subscription so for every message to
> the topic consumer gets two identical messages. The only solution to
> that is to either bounce the broker or shutdown the consumer, go to
> the console and delete durable subscriptions and start the consumer
> again.
> 

Refer to the ActiveMQ documentation on Stomp here:
http://activemq.apache.org/stomp.html

Note the discussion at the bottom of the page for the subscription name
property,

"For durable topic subscriptions you must specify the same clientId on
the connection and subcriptionName on the subscribe."

Regards


> 
> [27664] T+0 DEBUG (re)connecting...
> send [CONNECT
> client-id:adminbroker-test
> passcode:xxx
> login:xxx
> 
> ]
> receive [CONNECTED
> session:adminbroker-test
> 
> ]
> send [SUBSCRIBE
> activemq.prefetchSize:5
> activemq.subscriptionName:masterbcast
> ack:client-individual
> destination:/topic/COMMAND.broadcast
> 
> ]
> [27664] T+0 DEBUG subscribed to /topic/COMMAND.broadcast prefetchSize=5 durable name=masterbcast
> 
> ...
> 
> [27664] T+15 DEBUG got exit command, shutting down cleanly...
> send [UNSUBSCRIBE
> activemq.subscriptionName:masterbcast
> destination:/topic/COMMAND.broadcast
> 
> ]
> [27664] T+15 DEBUG unsubscribed from /topic/COMMAND.broadcast durable name=masterbcast
> send [DISCONNECT
> 
> ]
> 
> in activemq.log I see
> 
> 2011-05-27 13:01:07,042 | WARN  | Async error occurred: javax.jms.InvalidDestinationException: No durable subscription exists for: masterbcast | org.apache.activemq.broker.TransportConnection.Service | ActiveMQ Transport: ssl:///192.168.222.78:40678
> javax.jms.InvalidDestinationException: No durable subscription exists for: masterbcast
>         at org.apache.activemq.broker.region.TopicRegion.removeSubscription(TopicRegion.java:135)
>         at org.apache.activemq.broker.region.RegionBroker.removeSubscription(RegionBroker.java:491)
>         at org.apache.activemq.broker.BrokerFilter.removeSubscription(BrokerFilter.java:102)
>         at org.apache.activemq.broker.BrokerFilter.removeSubscription(BrokerFilter.java:102)
> 

-- 
Tim Bish
------------
FuseSource
Email: tim.bish@fusesource.com
Web: http://fusesource.com
Twitter: tabish121
Blog: http://timbish.blogspot.com/

Connect at CamelOne May 24-26

The Open Source Integration Conference


Re: STOMP and durable topic subscriptions

Posted by Aleksandar Ivanisevic <al...@ivanisevic.de>.

Update: 

I have browsed the stomp connector sources and managed to unsubscribe
by specifying subscription name in id: header, but the durable
subscription is still not gone from the console, and after subscribing
again i get all messages in duplicate.

UNSUBSCRIBE
destination:/topic/COMMAND.broadcast
id:masterbcast

Aleksandar Ivanisevic
<al...@ivanisevic.de> writes:

> Hi,
>
> what is the status on durable topic subscriptions under STOMP? Should
> STOMP unsubscribe remove the durable subscription or not?
>
> according to 
>
> http://mail-archives.apache.org/mod_mbox/activemq-users/200808.mbox/%3C19181282.post@talk.nabble.com%3E
>
> and
>
> https://issues.apache.org/jira/browse/AMQ-1890
>
> it should, but in my setup it doesnt, im using 5.4.2-fuse-03-15 and
> below is my session, after the last unsubscribe i can still see the
> subscription under offline durable subscriptions in the console.
>
> There is even more annoying bug where in some cases (not always),
> reconnecting creates a "double" subscription so for every message to
> the topic consumer gets two identical messages. The only solution to
> that is to either bounce the broker or shutdown the consumer, go to
> the console and delete durable subscriptions and start the consumer
> again.
>
>
> [27664] T+0 DEBUG (re)connecting...
> send [CONNECT
> client-id:adminbroker-test
> passcode:xxx
> login:xxx
>
> ]
> receive [CONNECTED
> session:adminbroker-test
>
> ]
> send [SUBSCRIBE
> activemq.prefetchSize:5
> activemq.subscriptionName:masterbcast
> ack:client-individual
> destination:/topic/COMMAND.broadcast
>
> ]
> [27664] T+0 DEBUG subscribed to /topic/COMMAND.broadcast prefetchSize=5 durable name=masterbcast
>
> ...
>
> [27664] T+15 DEBUG got exit command, shutting down cleanly...
> send [UNSUBSCRIBE
> activemq.subscriptionName:masterbcast
> destination:/topic/COMMAND.broadcast
>
> ]
> [27664] T+15 DEBUG unsubscribed from /topic/COMMAND.broadcast durable name=masterbcast
> send [DISCONNECT
>
> ]
>
> in activemq.log I see
>
> 2011-05-27 13:01:07,042 | WARN  | Async error occurred: javax.jms.InvalidDestinationException: No durable subscription exists for: masterbcast | org.apache.activemq.broker.TransportConnection.Service | ActiveMQ Transport: ssl:///192.168.222.78:40678
> javax.jms.InvalidDestinationException: No durable subscription exists for: masterbcast
>         at org.apache.activemq.broker.region.TopicRegion.removeSubscription(TopicRegion.java:135)
>         at org.apache.activemq.broker.region.RegionBroker.removeSubscription(RegionBroker.java:491)
>         at org.apache.activemq.broker.BrokerFilter.removeSubscription(BrokerFilter.java:102)
>         at org.apache.activemq.broker.BrokerFilter.removeSubscription(BrokerFilter.java:102)
>
>