You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by Riyafa Abdul Hameed <ri...@apache.org> on 2019/01/29 11:09:42 UTC
What is the purpose of the RoutingType for a queue in core api
Hi,
I am quite new to ActiveMQ Artemis core api and was trying out different
aspects and I couldn't find a purpose for specifying the RoutingType when
creating a queue:
session.createAddress(new SimpleString("a"), RoutingType.MULTICAST, true);
session.createQueue("a", RoutingType.MULTICAST, "b", true);
Whatever the RoutingType I mention for the createQueue function the queues
seem to behave in the same manner. I find that the behavior of the queues
are dependent on the RoutingType of the Address.
Can someone please point out to me the purpose of the RoutingType for a
queue in Artemis or point out a documentation to me?
Thank you.
Faithfully,
Riyafa
Re: What is the purpose of the RoutingType for a queue in core api
Posted by Francesco Nigro <ni...@gmail.com>.
I don't understand the question: on that url and on
https://activemq.apache.org/artemis/docs/latest/core.html there is an
explanation about what RoutingType is when related to an address/queue.
Routing Type for address isn't a separate concept from Routing Type of
queue: it has the same exact meaning/semantic.
Please help me to understand what is not clear.
Cheers,
Franz
Il giorno mar 29 gen 2019 alle ore 12:25 Riyafa Abdul Hameed <
riyafa@apache.org> ha scritto:
> Hi,
>
> I read through it. It doesn't provide the purpose of RoutingType for a
> queue. I understand what it means to an address but not a queue. Can you
> please explain?
>
> Thanks,
> Riyafa
>
> On Tue, Jan 29, 2019, 16:48 Francesco Nigro <nigro.fra@gmail.com wrote:
>
> > Yes sure:
> > https://activemq.apache.org/artemis/docs/latest/address-model.html
> >
> > Il giorno mar 29 gen 2019 alle ore 12:09 Riyafa Abdul Hameed <
> > riyafa@apache.org> ha scritto:
> >
> > > Hi,
> > >
> > > I am quite new to ActiveMQ Artemis core api and was trying out
> different
> > > aspects and I couldn't find a purpose for specifying the RoutingType
> when
> > > creating a queue:
> > >
> > > session.createAddress(new SimpleString("a"), RoutingType.MULTICAST,
> > true);
> > > session.createQueue("a", RoutingType.MULTICAST, "b", true);
> > >
> > > Whatever the RoutingType I mention for the createQueue function the
> > queues
> > > seem to behave in the same manner. I find that the behavior of the
> queues
> > > are dependent on the RoutingType of the Address.
> > >
> > > Can someone please point out to me the purpose of the RoutingType for a
> > > queue in Artemis or point out a documentation to me?
> > >
> > > Thank you.
> > >
> > > Faithfully,
> > > Riyafa
> > >
> >
>
Re: What is the purpose of the RoutingType for a queue in core api
Posted by Riyafa Abdul Hameed <ri...@apache.org>.
Hi,
I read through it. It doesn't provide the purpose of RoutingType for a
queue. I understand what it means to an address but not a queue. Can you
please explain?
Thanks,
Riyafa
On Tue, Jan 29, 2019, 16:48 Francesco Nigro <nigro.fra@gmail.com wrote:
> Yes sure:
> https://activemq.apache.org/artemis/docs/latest/address-model.html
>
> Il giorno mar 29 gen 2019 alle ore 12:09 Riyafa Abdul Hameed <
> riyafa@apache.org> ha scritto:
>
> > Hi,
> >
> > I am quite new to ActiveMQ Artemis core api and was trying out different
> > aspects and I couldn't find a purpose for specifying the RoutingType when
> > creating a queue:
> >
> > session.createAddress(new SimpleString("a"), RoutingType.MULTICAST,
> true);
> > session.createQueue("a", RoutingType.MULTICAST, "b", true);
> >
> > Whatever the RoutingType I mention for the createQueue function the
> queues
> > seem to behave in the same manner. I find that the behavior of the queues
> > are dependent on the RoutingType of the Address.
> >
> > Can someone please point out to me the purpose of the RoutingType for a
> > queue in Artemis or point out a documentation to me?
> >
> > Thank you.
> >
> > Faithfully,
> > Riyafa
> >
>
Re: What is the purpose of the RoutingType for a queue in core api
Posted by Francesco Nigro <ni...@gmail.com>.
Yes sure: https://activemq.apache.org/artemis/docs/latest/address-model.html
Il giorno mar 29 gen 2019 alle ore 12:09 Riyafa Abdul Hameed <
riyafa@apache.org> ha scritto:
> Hi,
>
> I am quite new to ActiveMQ Artemis core api and was trying out different
> aspects and I couldn't find a purpose for specifying the RoutingType when
> creating a queue:
>
> session.createAddress(new SimpleString("a"), RoutingType.MULTICAST, true);
> session.createQueue("a", RoutingType.MULTICAST, "b", true);
>
> Whatever the RoutingType I mention for the createQueue function the queues
> seem to behave in the same manner. I find that the behavior of the queues
> are dependent on the RoutingType of the Address.
>
> Can someone please point out to me the purpose of the RoutingType for a
> queue in Artemis or point out a documentation to me?
>
> Thank you.
>
> Faithfully,
> Riyafa
>
Re: What is the purpose of the RoutingType for a queue in core api
Posted by Riyafa Abdul Hameed <ri...@apache.org>.
Hi,
Thank you very much. Your explanations certainly helped to clarified my
doubts.
Thanks again,
Riyafa
On Tue, Jan 29, 2019, 21:33 Justin Bertram <jbertram@apache.org wrote:
> > That means if the RoutingType of the address is MULTICAST then will it
> only support MULTICAST queues?
>
> That's correct. However, by default auto-create-addresses is 'true' so when
> a queue is created on an address with a routing type that the address
> doesn't support the address will be automatically modified to support it.
> If auto-create-addresses was 'false' an exception would be thrown.
>
>
> > If there is a MULTICAST address and two ANYCAST queues are bound to this
> address what should be the behavior on a Message that does not have any
> routing type specified?
>
> As noted previously, you can't bind a queue to an address with a routing
> type which the address doesn't support. Therefore it would technically be
> impossible to have a multicast address with 2 anycast queues.
>
> However, if, for example, you had an address that supported both multicast
> and anycast queues and there were 2 anycast queues and 2 multicast queues
> and a message with no routing type was sent to that address then the
> message would be routed to one of the anycast queues and both of the
> multicast queues. In that same scenario if a multicast message was sent
> then it would be routed to both of the multicast queues and none of the
> anycast queues. Likewise, if an anycast message was sent then it would be
> routed to one of the anycast queues and none of the multicast queues.
>
>
> > Is it not wrong to attach an ANYCAST queue to a MULTICAST address?
>
> As I stated previously, by default the address will be modified
> automatically to support the routing type of any queue bound to it.
>
>
> > What should be the behavior if multiple consumers attach to a MULTICAST
> queue?
>
> With regards to consumption, a queue is just a queue. The routing type has
> no meaning here. All consumers compete for messages on the queue. From an
> application's perspective this is often used for what's called "shared
> subscriptions" use-cases.
>
> Hope that helps!
>
>
> Justin
>
> On Tue, Jan 29, 2019 at 8:44 AM Riyafa Abdul Hameed <ri...@apache.org>
> wrote:
>
> > Hi Justin,
> >
> > Thank you very much for the clarification. That means if the RoutingType
> of
> > the address is MULTICAST then will it only support MULTICAST queues? If
> > there is a MULTICAST address and two ANYCAST queues are bound to this
> > address what should be the behavior on a Message that does not have any
> > routing type specified?
> > I quickly tried this by creating such a config as follows:
> >
> > session.createAddress(new SimpleString("h"),
> > RoutingType.MULTICAST, true);
> > session.createQueue("h", RoutingType.ANYCAST, "i", true);
> > session.createQueue("h", RoutingType.ANYCAST, "j", true);
> >
> > The messages seemed to go to the consumers for each of the queues in a
> > round robin fashion. Is it not wrong to attach an ANYCAST queue to a
> > MULTICAST address?
> >
> > What should be the behavior if multiple consumers attach to a MULTICAST
> > queue? I noticed that this also gives raise to messages being routed in a
> > roundrobin fashion.
> >
> > Thanks,
> > Riyafa
> >
> >
> > On Tue, 29 Jan 2019 at 18:42, Justin Bertram <jb...@apache.org>
> wrote:
> >
> > > Under the covers the routing type for an address indicates which kind
> of
> > > queues the address supports. The routing type of a queue indicates how
> > > messages should be routed from the address to the queue. The routing
> type
> > > can also be set on a message and that also determines how the message
> > > should be routed, e.g. a multicast message sent directly to an anycast
> > > queue will not actually be routed to that queue and vice versa. Also,
> if
> > > there are multiple types of queues on the same address messages
> without a
> > > routing type are routed differently than those with a routing type.
> > >
> > >
> > > Justin
> > >
> > > On Tue, Jan 29, 2019 at 5:09 AM Riyafa Abdul Hameed <riyafa@apache.org
> >
> > > wrote:
> > >
> > > > Hi,
> > > >
> > > > I am quite new to ActiveMQ Artemis core api and was trying out
> > different
> > > > aspects and I couldn't find a purpose for specifying the RoutingType
> > when
> > > > creating a queue:
> > > >
> > > > session.createAddress(new SimpleString("a"), RoutingType.MULTICAST,
> > > true);
> > > > session.createQueue("a", RoutingType.MULTICAST, "b", true);
> > > >
> > > > Whatever the RoutingType I mention for the createQueue function the
> > > queues
> > > > seem to behave in the same manner. I find that the behavior of the
> > queues
> > > > are dependent on the RoutingType of the Address.
> > > >
> > > > Can someone please point out to me the purpose of the RoutingType
> for a
> > > > queue in Artemis or point out a documentation to me?
> > > >
> > > > Thank you.
> > > >
> > > > Faithfully,
> > > > Riyafa
> > > >
> > >
> >
>
Re: What is the purpose of the RoutingType for a queue in core api
Posted by Justin Bertram <jb...@apache.org>.
> That means if the RoutingType of the address is MULTICAST then will it
only support MULTICAST queues?
That's correct. However, by default auto-create-addresses is 'true' so when
a queue is created on an address with a routing type that the address
doesn't support the address will be automatically modified to support it.
If auto-create-addresses was 'false' an exception would be thrown.
> If there is a MULTICAST address and two ANYCAST queues are bound to this
address what should be the behavior on a Message that does not have any
routing type specified?
As noted previously, you can't bind a queue to an address with a routing
type which the address doesn't support. Therefore it would technically be
impossible to have a multicast address with 2 anycast queues.
However, if, for example, you had an address that supported both multicast
and anycast queues and there were 2 anycast queues and 2 multicast queues
and a message with no routing type was sent to that address then the
message would be routed to one of the anycast queues and both of the
multicast queues. In that same scenario if a multicast message was sent
then it would be routed to both of the multicast queues and none of the
anycast queues. Likewise, if an anycast message was sent then it would be
routed to one of the anycast queues and none of the multicast queues.
> Is it not wrong to attach an ANYCAST queue to a MULTICAST address?
As I stated previously, by default the address will be modified
automatically to support the routing type of any queue bound to it.
> What should be the behavior if multiple consumers attach to a MULTICAST
queue?
With regards to consumption, a queue is just a queue. The routing type has
no meaning here. All consumers compete for messages on the queue. From an
application's perspective this is often used for what's called "shared
subscriptions" use-cases.
Hope that helps!
Justin
On Tue, Jan 29, 2019 at 8:44 AM Riyafa Abdul Hameed <ri...@apache.org>
wrote:
> Hi Justin,
>
> Thank you very much for the clarification. That means if the RoutingType of
> the address is MULTICAST then will it only support MULTICAST queues? If
> there is a MULTICAST address and two ANYCAST queues are bound to this
> address what should be the behavior on a Message that does not have any
> routing type specified?
> I quickly tried this by creating such a config as follows:
>
> session.createAddress(new SimpleString("h"),
> RoutingType.MULTICAST, true);
> session.createQueue("h", RoutingType.ANYCAST, "i", true);
> session.createQueue("h", RoutingType.ANYCAST, "j", true);
>
> The messages seemed to go to the consumers for each of the queues in a
> round robin fashion. Is it not wrong to attach an ANYCAST queue to a
> MULTICAST address?
>
> What should be the behavior if multiple consumers attach to a MULTICAST
> queue? I noticed that this also gives raise to messages being routed in a
> roundrobin fashion.
>
> Thanks,
> Riyafa
>
>
> On Tue, 29 Jan 2019 at 18:42, Justin Bertram <jb...@apache.org> wrote:
>
> > Under the covers the routing type for an address indicates which kind of
> > queues the address supports. The routing type of a queue indicates how
> > messages should be routed from the address to the queue. The routing type
> > can also be set on a message and that also determines how the message
> > should be routed, e.g. a multicast message sent directly to an anycast
> > queue will not actually be routed to that queue and vice versa. Also, if
> > there are multiple types of queues on the same address messages without a
> > routing type are routed differently than those with a routing type.
> >
> >
> > Justin
> >
> > On Tue, Jan 29, 2019 at 5:09 AM Riyafa Abdul Hameed <ri...@apache.org>
> > wrote:
> >
> > > Hi,
> > >
> > > I am quite new to ActiveMQ Artemis core api and was trying out
> different
> > > aspects and I couldn't find a purpose for specifying the RoutingType
> when
> > > creating a queue:
> > >
> > > session.createAddress(new SimpleString("a"), RoutingType.MULTICAST,
> > true);
> > > session.createQueue("a", RoutingType.MULTICAST, "b", true);
> > >
> > > Whatever the RoutingType I mention for the createQueue function the
> > queues
> > > seem to behave in the same manner. I find that the behavior of the
> queues
> > > are dependent on the RoutingType of the Address.
> > >
> > > Can someone please point out to me the purpose of the RoutingType for a
> > > queue in Artemis or point out a documentation to me?
> > >
> > > Thank you.
> > >
> > > Faithfully,
> > > Riyafa
> > >
> >
>
Re: What is the purpose of the RoutingType for a queue in core api
Posted by Riyafa Abdul Hameed <ri...@apache.org>.
Hi Justin,
Thank you very much for the clarification. That means if the RoutingType of
the address is MULTICAST then will it only support MULTICAST queues? If
there is a MULTICAST address and two ANYCAST queues are bound to this
address what should be the behavior on a Message that does not have any
routing type specified?
I quickly tried this by creating such a config as follows:
session.createAddress(new SimpleString("h"),
RoutingType.MULTICAST, true);
session.createQueue("h", RoutingType.ANYCAST, "i", true);
session.createQueue("h", RoutingType.ANYCAST, "j", true);
The messages seemed to go to the consumers for each of the queues in a
round robin fashion. Is it not wrong to attach an ANYCAST queue to a
MULTICAST address?
What should be the behavior if multiple consumers attach to a MULTICAST
queue? I noticed that this also gives raise to messages being routed in a
roundrobin fashion.
Thanks,
Riyafa
On Tue, 29 Jan 2019 at 18:42, Justin Bertram <jb...@apache.org> wrote:
> Under the covers the routing type for an address indicates which kind of
> queues the address supports. The routing type of a queue indicates how
> messages should be routed from the address to the queue. The routing type
> can also be set on a message and that also determines how the message
> should be routed, e.g. a multicast message sent directly to an anycast
> queue will not actually be routed to that queue and vice versa. Also, if
> there are multiple types of queues on the same address messages without a
> routing type are routed differently than those with a routing type.
>
>
> Justin
>
> On Tue, Jan 29, 2019 at 5:09 AM Riyafa Abdul Hameed <ri...@apache.org>
> wrote:
>
> > Hi,
> >
> > I am quite new to ActiveMQ Artemis core api and was trying out different
> > aspects and I couldn't find a purpose for specifying the RoutingType when
> > creating a queue:
> >
> > session.createAddress(new SimpleString("a"), RoutingType.MULTICAST,
> true);
> > session.createQueue("a", RoutingType.MULTICAST, "b", true);
> >
> > Whatever the RoutingType I mention for the createQueue function the
> queues
> > seem to behave in the same manner. I find that the behavior of the queues
> > are dependent on the RoutingType of the Address.
> >
> > Can someone please point out to me the purpose of the RoutingType for a
> > queue in Artemis or point out a documentation to me?
> >
> > Thank you.
> >
> > Faithfully,
> > Riyafa
> >
>
Re: What is the purpose of the RoutingType for a queue in core api
Posted by Justin Bertram <jb...@apache.org>.
Under the covers the routing type for an address indicates which kind of
queues the address supports. The routing type of a queue indicates how
messages should be routed from the address to the queue. The routing type
can also be set on a message and that also determines how the message
should be routed, e.g. a multicast message sent directly to an anycast
queue will not actually be routed to that queue and vice versa. Also, if
there are multiple types of queues on the same address messages without a
routing type are routed differently than those with a routing type.
Justin
On Tue, Jan 29, 2019 at 5:09 AM Riyafa Abdul Hameed <ri...@apache.org>
wrote:
> Hi,
>
> I am quite new to ActiveMQ Artemis core api and was trying out different
> aspects and I couldn't find a purpose for specifying the RoutingType when
> creating a queue:
>
> session.createAddress(new SimpleString("a"), RoutingType.MULTICAST, true);
> session.createQueue("a", RoutingType.MULTICAST, "b", true);
>
> Whatever the RoutingType I mention for the createQueue function the queues
> seem to behave in the same manner. I find that the behavior of the queues
> are dependent on the RoutingType of the Address.
>
> Can someone please point out to me the purpose of the RoutingType for a
> queue in Artemis or point out a documentation to me?
>
> Thank you.
>
> Faithfully,
> Riyafa
>