You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by Thai Le <ln...@gmail.com> on 2023/03/24 22:21:08 UTC

how to get the resourceName of a queue ?

Hello,

I have 2 queues with the same name Q, one in address A1 and one in address
A2. How do I make a *resource name* of queue Q in A1 ? I'm trying to use
the java artemis client to do some management operations and i need the
resource name for:
ManagementHelper.putOperationInvocation(session.createMessage(true),
*resourceName*, "moveMessages", filter, anotherQueue)

Thank you in advance

Thai Le

Re: how to get the resourceName of a queue ?

Posted by Justin Bertram <jb...@apache.org>.
Queue names are globally unique. You cannot have two queues with the same
name on two different addresses. This is covered in the documentation [1].

In any case, you can use
org.apache.activemq.artemis.api.core.management.ResourceNames class to help
build the proper resource name. In your case you'd use ResourceNames.QUEUE,
e.g.:


ManagementHelper.putOperationInvocation(session.createMessage(true),
ResourceNames.QUEUE
+ "Q", "moveMessages", filter, anotherQueue);

That said, passing in "session.createMessage(true)" means you won't have a
handle to actually use the message once the management helper has done its
work.


Justin

[1]
https://activemq.apache.org/components/artemis/documentation/latest/address-model.html#queue

On Fri, Mar 24, 2023 at 5:21 PM Thai Le <ln...@gmail.com> wrote:

> Hello,
>
> I have 2 queues with the same name Q, one in address A1 and one in address
> A2. How do I make a *resource name* of queue Q in A1 ? I'm trying to use
> the java artemis client to do some management operations and i need the
> resource name for:
> ManagementHelper.putOperationInvocation(session.createMessage(true),
> *resourceName*, "moveMessages", filter, anotherQueue)
>
> Thank you in advance
>
> Thai Le
>