You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by "Frison, Louisa (EXT)" <Lo...@union-investment.de> on 2022/03/15 15:44:50 UTC

Durable subscriptions with fqqn results in AMQ229019: Queue already exists

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

Re: Durable subscriptions with fqqn results in AMQ229019: Queue already exists

Posted by Robbie Gemmell <ro...@gmail.com>.
Is it really a workaround? I was under the impression that was the
actual expected use case, and its the only example given in the docs.

On Wed, 16 Mar 2022 at 13:39, Justin Bertram <jb...@apache.org> wrote:
>
> Is the work-around I outlined viable for you or are you waiting on the fix?
>
>
> Justin
>
> On Wed, Mar 16, 2022 at 6:01 AM Frison, Louisa (EXT) <
> Louisa.Frison@union-investment.de> wrote:
>
> > Cool, I just opened a ticket for it, thanks for taking the time to answer
> > my question !
> >
> > Louisa
> >
> >

Re: Durable subscriptions with fqqn results in AMQ229019: Queue already exists

Posted by Justin Bertram <jb...@apache.org>.
Is the work-around I outlined viable for you or are you waiting on the fix?


Justin

On Wed, Mar 16, 2022 at 6:01 AM Frison, Louisa (EXT) <
Louisa.Frison@union-investment.de> wrote:

> Cool, I just opened a ticket for it, thanks for taking the time to answer
> my question !
>
> Louisa
>
>

Durable subscriptions with fqqn results in AMQ229019: Queue already exists

Posted by "Frison, Louisa (EXT)" <Lo...@union-investment.de>.
Cool, I just opened a ticket for it, thanks for taking the time to answer my question ! 

Louisa


Re: Durable subscriptions with fqqn results in AMQ229019: Queue already exists

Posted by Justin Bertram <jb...@apache.org>.
This is indeed the right list for your question.  :)

In short, I think this is a bug. Please open a Jira [1].

That said, I think there's a simple work-around - just treat the
subscription queue like a normal JMS queue. For example:

      ActiveMQConnectionFactory cf = new ActiveMQConnectionFactory("tcp://
127.0.0.1:61616");
      Connection connection = cf.createConnection();
      connection.start();
      Session session = connection.createSession();
      Queue queue =
session.createQueue("TESTADRESS::queueNameThatAlreadyExists");
      session.createConsumer(queue);

Generally speaking, when you're working with an FQQN you want to treat it
as a JMS queue because the FQQN refers directly to a core queue.


Justin

[1] https://issues.apache.org/jira/projects/ARTEMIS

On Tue, Mar 15, 2022 at 11:01 AM Frison, Louisa (EXT) <
Louisa.Frison@union-investment.de> wrote:

>
> 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
>