Wafa
Wafa

Reputation: 196

WildFly embedded ActiveMQ Artemis: Difference between queue and jms-queue

What is the difference between queue and jms-queue declaration in the server configuration in the activemq-messaging subsystem?

Could the queue be used with a MessageDriven bean instead of a jms-queue?

I'm using Wildlfy 19 and Artemis 2.12.0

Upvotes: 2

Views: 1007

Answers (1)

Justin Bertram
Justin Bertram

Reputation: 35038

ActiveMQ Artemis supports the JMS API, but it also supports industry standard protocols like AMQP, STOMP, OpenWire, & MQTT. Therefore the broker's underlying address model is not JMS-specific but rather more generic & flexible in order to support numerous different use-cases.

The bare queue refers to the underlying "core" queue from ActiveMQ Artemis. I believe WildFly exposes this low-level component to support unforeseen use-cases. The queue configuration gives control over the address and routing-type which are the other two main components of the ActiveMQ Artemis address model.

The jms-queue refers to the traditional JMS resource which MDBs and other JMS application components will use in a Java/Jakarta EE application server. It gives you control of JNDI entries which queue does not. It serves as a kind of familiar "wrapper" around the core queue. That's why there's so much overlap with the attributes and operations between the two.

There's really no reason to use queue in lieu of jms-queue unless you absolutely must. A jms-queue is more straight-forward to configure and understand for almost all use-cases. The only reason to use a queue is if you needed to control the address and routing-type in a way that isn't allowed by jms-queue. This is highly unlikely for JMS applications.

It is possible, for example, to send messages to or consumer a message from a queue, but since queue lacks a way to configure JNDI bindings the JMS client would have to instantiate the queue directly using javax.jms.Session.createQueue(String). However, this method is discouraged as it reduces the portability of the application.

Upvotes: 5

Related Questions