1
votes

What am I doing wrong here? I'm trying to use Stomp to test some things with Artemis 2.13.0, but when I uses either the command line utility of a Python script, I can't subscribe to a queue, even after I use the utility to publish a message to an address.

Also, if I give it a new queue name, it creates it, but then doesn't pull messages I publish to it. This is confusing. My actual Java app behaves nothing like this -- it's using JMS

I'm connection like this with the utility:

stomp -H 192.168.56.105 -P 61616 -U user -W password
> subscribe test3.topic::test.A.queue

Which give me this error:

Subscribing to 'test3.topic::test.A.queue' with acknowledge set to 'auto', id set to '1'
>
AMQ229019: Queue test.A.queue already exists on address test3.topic

Which makes me think Stomp is trying to create the queue when it subscribes, but I don't see how to manage this in the documentation. http://jasonrbriggs.github.io/stomp.py/api.html

I also have a Python script giving me the same issue.

import os
import time
import stomp

def connect_and_subscribe(conn):
    conn.connect('user', 'password', wait=True)
    conn.subscribe(destination='test3.topic::test.A.queue', id=1, ack='auto')

class MyListener(stomp.ConnectionListener):
    def __init__(self, conn):
        self.conn = conn

    def on_error(self, headers, message):
        print('received an error "%s"' % message)

    def on_message(self, headers, message):
        print('received a message "%s"' % message)
        """for x in range(10):
            print(x)
            time.sleep(1)
        print('processed message')"""

    def on_disconnected(self):
        print('disconnected')
        connect_and_subscribe(self.conn)

conn = stomp.Connection([('192.168.56.105', 61616)], heartbeats=(4000, 4000))
conn.set_listener('', MyListener(conn))
connect_and_subscribe(conn)
time.sleep(1000)
conn.disconnect()
1
How come you're using the fully-qualified-queue-name (FQQN)? Normal use-cases don't require this. Also, what version of ActiveMQ Artemis are you using?Justin Bertram
I've tried only use the queue name as well. I expected the queues to be created by the subscribe and then disappear after disconnecting, and that FQQNs are best for this.BenW
There are distinct differences between how multicast (aka pub-sub or topic) and anycast (aka point-to-point or queue) semantics work. What exact behavior are you looking for? Also, what version of ActiveMQ Artemis are you using?Justin Bertram
Artemis 2.13.0 Multicast. I'm publishing to an address with the intention of creating queues to subscribe to, while the subscribers are connected.BenW
If you're using multicast and you want your clients to receive the messages published to an address then why not just subscribe to the multicast address (i.e. topic) rather than the FQQN? That's what is normally done for this use-case.Justin Bertram

1 Answers

0
votes

I recommend you try the latest release of ActiveMQ Artemis. Since 2.13.0 was released a year ago a handful of STOMP related issues have been fixed specifically ARTEMIS-2817 which looks like your use-case.

It's not clear to me why you're using the fully-qualified-queue-name (FQQN) so I'm inclined to think this is not the right approach, but regardless the issue you're hitting should be fixed in later versions. If you want multiple consumers to share the messages on a single subscription then using FQQN would be a good option there.

Also, if you want to use the topic/ or queue/ prefix to control routing semantics from the broker then you should set the anycastPrefix and multicastPrefix appropriately as described in the documentation.


This may be coincidence but ARTEMIS-2817 was originally reported by "BENJAMIN Lee WARRICK" which is surprisingly similar to "BenW" (i.e. your name).