Hello everyone :)
I hope I'm right here with a question about the
org.apache.activemq:artemis-jms-client:2.20.0
I'm fairly new to that.

I need to subscribe to an already existing multicast-queue (I have a 
service-migration that should take over the subscription of an already 
subscribed service which will then get shut down)
and I tried that using the FQQN like this:

            //PREPARATIONS: create a multicast-queue named 
queueNameThatAlreadyExists under the address TESTADRESS

        ActiveMQConnectionFactory cf = new 
ActiveMQConnectionFactory("tcp://127.0.0.1:61616");
        cf.setClientID("clientID");

        Connection connection = cf.createConnection();
        connection.start();
        Session session = connection.createSession();
        Topic topic = 
session.createTopic("TESTADRESS::queueNameThatAlreadyExists");
        session.createDurableSubscriber(topic, "subscriptionName", null, false);

This unfortunately triggers the following exception:

            Exception in thread "main" javax.jms.InvalidDestinationException: 
AMQ229019: Queue queueNameThatAlreadyExists already exists on address TESTADRESS
            at 
org.apache.activemq.artemis.core.protocol.core.impl.ChannelImpl.sendBlocking(ChannelImpl.java:549)
            at 
org.apache.activemq.artemis.core.protocol.core.impl.ChannelImpl.sendBlocking(ChannelImpl.java:443)
            at 
org.apache.activemq.artemis.core.protocol.core.impl.ActiveMQSessionContext.createQueue(ActiveMQSessionContext.java:821)
            at 
org.apache.activemq.artemis.core.client.impl.ClientSessionImpl.internalCreateQueue(ClientSessionImpl.java:2054)
            at 
org.apache.activemq.artemis.core.client.impl.ClientSessionImpl.createQueue(ClientSessionImpl.java:307)
            at 
org.apache.activemq.artemis.jms.client.ActiveMQSession.createQueue(ActiveMQSession.java:1274)
            at 
org.apache.activemq.artemis.jms.client.ActiveMQSession.createConsumer(ActiveMQSession.java:878)
            at 
org.apache.activemq.artemis.jms.client.ActiveMQSession.createDurableSubscriber(ActiveMQSession.java:598)
            at Main.main(Main.java:18)
            Caused by: ActiveMQQueueExistsException[errorType=QUEUE_EXISTS 
message=AMQ229019: Queue queueNameThatAlreadyExists already exists on address 
TESTADRESS]
            ... 9 more

I debugged it a little and it seems like in here:

        
https://github.com/apache/activemq-artemis/blob/main/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQSession.java
        I think starting from Line 872 lies the reason: the existence of the 
multicast queue gets checked with a queueQuery using a queuename of pattern 
clientID.subscriptionName,
            which of course does not exist and subsequently tries to create a 
queue with the queueName taken from the FQQN ... which does exist ...

I think that shouldn't happen.
I've found no solutions on the internet and on the mailing list, do you have 
any ideas ?
Would a bug ticket be justified here ?
Thanks a lot for your help :D

Reply via email to