You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by Christopher Pisz <ch...@gmail.com> on 2020/08/11 17:15:42 UTC

address vs queue

I read that an address can have many queues. I am not sure what an address
really is otherwise. I only have one field in my stomp messages that I can
specify, and it is labeled "destination", is that the address name or the
queue name?

How would I even specify the other?

Or does Artemis create a queue per subscription? If so, then why would you
put anything in the config for it, because you don't know the subscription
will exist until it is made.

I am confused.

Re: address vs queue

Posted by Christopher Pisz <ch...@gmail.com>.
I recently read this:

"Prefixes

Using prefixes involves specifying the anycastPrefix and/or the
multicastPrefix on the acceptor which the STOMP client is using. For the
STOMP use-case these prefixes tell the broker that destinations using them
should be treated as anycast or multicast. For example, if the acceptor has
anycastPrefix=queue/ then when a STOMP client sends a message to
destination:queue/foo the broker will auto-create the address foo and queue
foo appropriately as anycast and the message will be placed in that queue.
Additionally, if the acceptor has multicastPrefix=topic/ then when a STOMP
client sends a message to destination:topic/bar the broker will auto-create
the address bar as multicast, but it won't create a queue since multicast
(i.e. pub/sub) semantics require a client to explicitly create a
subscription to receive those messages.

Note: The anycastPrefix and/or multicastPrefix on the acceptor will be
stripped from the destination value.

"


If I have
* Two clients A and B both subscribed to destination "chat"
* Defined prefix "anycastPrefix=queue/"
* Sent a message from client A

Isn't there a chance client A is going to receive its own message and
therefore client B will never get it?

The spec I was handed uses "queue/blah" destinations, so I assume my user
expects anycast, but I don't know why the same destination would be used in
that case for messages only coming from client A and messages only coming
from client B.

On Tue, Aug 11, 2020 at 2:34 PM Justin Bertram <jb...@apache.org> wrote:

> ActiveMQ Artemis was designed from the ground up to support multiple
> protocols. As such, it needs a flexible and powerful address model to
> support lots of different use cases across the wide variety of supported
> protocols. This flexibility can sometimes be confusing for users of STOMP
> which only defines a flat "destination" with no particular semantics. In
> general just remember that you send messages to an address and consume
> messages from a queue. When a message is sent to an address it is routed to
> the queues bound to that address.
>
> For a STOMP client using auto-creation the "destination" header should have
> the same value for both producers and consumers. The broker will take care
> of the rest under the covers.
>
> In the case of publish-subscribe semantics the broker will create a queue
> for each subscription. You wouldn't normally configure this queue
> statically in broker.xml, although you could if you really wanted to for
> some reason (again, the model is flexible).
>
> I hope that helps.
>
>
> Justin
>
> On Tue, Aug 11, 2020 at 12:16 PM Christopher Pisz <
> christopherpisz@gmail.com>
> wrote:
>
> > I read that an address can have many queues. I am not sure what an
> address
> > really is otherwise. I only have one field in my stomp messages that I
> can
> > specify, and it is labeled "destination", is that the address name or the
> > queue name?
> >
> > How would I even specify the other?
> >
> > Or does Artemis create a queue per subscription? If so, then why would
> you
> > put anything in the config for it, because you don't know the
> subscription
> > will exist until it is made.
> >
> > I am confused.
> >
>

Re: address vs queue

Posted by Justin Bertram <jb...@apache.org>.
ActiveMQ Artemis was designed from the ground up to support multiple
protocols. As such, it needs a flexible and powerful address model to
support lots of different use cases across the wide variety of supported
protocols. This flexibility can sometimes be confusing for users of STOMP
which only defines a flat "destination" with no particular semantics. In
general just remember that you send messages to an address and consume
messages from a queue. When a message is sent to an address it is routed to
the queues bound to that address.

For a STOMP client using auto-creation the "destination" header should have
the same value for both producers and consumers. The broker will take care
of the rest under the covers.

In the case of publish-subscribe semantics the broker will create a queue
for each subscription. You wouldn't normally configure this queue
statically in broker.xml, although you could if you really wanted to for
some reason (again, the model is flexible).

I hope that helps.


Justin

On Tue, Aug 11, 2020 at 12:16 PM Christopher Pisz <ch...@gmail.com>
wrote:

> I read that an address can have many queues. I am not sure what an address
> really is otherwise. I only have one field in my stomp messages that I can
> specify, and it is labeled "destination", is that the address name or the
> queue name?
>
> How would I even specify the other?
>
> Or does Artemis create a queue per subscription? If so, then why would you
> put anything in the config for it, because you don't know the subscription
> will exist until it is made.
>
> I am confused.
>