Chapter 23. Queue Attributes

Queue attributes can be set in one of two ways; by configuring them using the configuration file or by using the core API. This chapter will explain how to configure each attribute and what effect the attribute has.

23.1. Predefined Queues

Queues can be predefined through configuration at a core level or at a JMS level. First look at a JMS level.
JMS Level

The following shows a queue predefined in the JBOSS_DIST/jboss-as/server/<PROFILE>/deploy/hornetq/hornetq-jms.xml configuration file.

<queue name="selectorQueue">
   <entry name="/queue/selectorQueue"/>
   <selector string="color='red'"/>
   <durable>true</durable>
</queue>
This name attribute of <queue> defines the name of the queue. When doing this at a JMS level a naming convention is followed so the actual name of the core queue will be jms.queue.selectorQueue.
The mandatory <entry> element configures the name used to bind the queue to JNDI. <queue> can contain multiple <entry> elements to bind the same queue to different names.
The optional <selector> element defines what JMS message selector the predefined queue will have. Only messages that match the selector will be added to the queue. When omitted from the <queue> the default value is null.
The optional <durable> element specifies whether the queue is persisted. When omitted from the <queue> the default value is true.
Core Level

A queue can be predefined at a core level in the <JBOSS_HOME>/jboss-as/server/<PROFILE>/deploy/hornetq/hornetq-configuration.xml file.

<queues>     
   <queue name="jms.queue.selectorQueue">
      <address>jms.queue.selectorQueue</address>
      <filter string="color='red'"/>
      <durable>true</durable>
</queues>
This is very similar to the JMS configuration, with the following exceptions:
  1. The name attribute of queue is the actual name used for the queue with no naming convention as in JMS.
  2. The address element defines what address is used for routing messages.
  3. There is no entry element.
  4. The filter uses the Core filter syntax (described in Chapter 12, Filter Expressions), not the JMS selector syntax.