> 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 <[email protected]>
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 <[email protected]> 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 <[email protected]>
> > 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
> > >
> >
>

Reply via email to