Chapter 24. Queue Attributes

Queue attributes can be set in one of two ways. Either 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.

24.1. Predefined Queues

Queues can be predefined via configuration at a core level or at a JMS level. Firstly lets look at a JMS level.

The following shows a queue predefined in the jbm-jms.xml configuration file.

<queue name="selectorQueue">
      <entry name="/queue/selectorQueue"/>
      <selector string="color='red'"/>

This name attribute of queue defines the name of the queue. When we do this at a jms level we follow a naming convention so the actual name of the core queue will be jms.queue.selectorQueue.

The entry element configures the name that will be used to bind the queue to JNDI. This is a mandatory element and the queue can contain multiple of these to bind the same queue to different names.

The selector element defines what JMS message selector the predefined queue will have. Only messages that match the selector will be added to the queue. This is an optional element with a default of null when omitted.

The durable element specifies whether the queue will be persisted. This again is optional and defaults to true if omitted.

Secondly a queue can be predefined at a core level in the jbm-configuration.xml file. The following is an example.

   	<queue name="jms.queue.selectorQueue">
   	    <filter string="color='red'"/>

This is very similar to the JMS configuration, with 3 real differences which are.

  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.

24.2. Using the API

Queues can also be created using the core API or the management API.

For the core API, queues can be created via the org.jboss.messaging.core.client.ClientSession interface. There are multiple createQueue methods that support setting all of the previously mentioned attributes. There is one extra attribute that can be set via this API which is temporary. setting this to true means that the queue will be deleted once the session is disconnected.

Take a look at Chapter 29, Management for a description of the management API for creating queues.

24.3. Configuring Queues Via Address Settings

There are some attributes that are defined against a queue rather than a specific queue. Here an example of an address-setting entry that would be found in the jbm-configuration.xml file.

    <address-setting match="jms.queue.exampleQueue">

These are explained fully throughout the user manual, howvere here is a breif description with a link to the appropriate chapter if available.

max-delivery-attempts defines how many time a cancelled message can be redelivered before sending to the dead-letter-address. A full explanation can be found here.

redelivery-delay defines how long to wait before attempting redelivery of a cancelled message. see here.

expiry-address defines where to send a message that has expired. see here.

last-value-queue defines whether a queue only uses last values or not. see here.

distribution-policy-class define the class to use for distribution of messages by a queue to consumers. By default this is org.jboss.messaging.core.server.impl.RoundRobinDistributor.

max-size-bytes and page-size-bytes are used to set paging on an address. This is explained here.

redistribution-delay defines how long to wait when the last consumer is closed on a queue before redistributing any messages. see here.