Configuring JMS destinations

Recommended by 0 users

Configuring JMS destinations

Along with the definition of connection factories in the JMS subsystem, you can find the JMS destinations (Queues and Topics), which are part of the server distribution:

<jms-queue name=”testQueue”>

<entry name=”queue/test”/>


<jms-topic name=”testTopic”>

<entry name=”topic/test”/>


This name attribute of queue defines the name of the queue. At JMS level, the actual name of the queue follows a naming convention, so it will be jms.queue.testQueue.

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.

So, for example, here’s how you would configure a MessageDrivenBean component to consume messages from the “queue/test” Queue:

@MessageDriven(name = “MessageMDBSample”, activationConfig = {

@ActivationConfigProperty(propertyName = “destinationType”,

propertyValue = “javax.jms.Queue”),

@ActivationConfigProperty(propertyName = “destination”,

propertyValue = ” queue/test”),

@ActivationConfigProperty(propertyName = “acknowledgeMode”,

propertyValue = “Auto-acknowledge”) })

public class SampleMDBean implements MessageListener {


private MessageDrivenContext context; }


Why it’s useful to know the actual destination name?

Apparently it seems not important at all to know the server’s destination name (in the Apparently it seems not important at all to know the server’s destination name (in the example jms.queue.testQueue). Rather, we would be concerned about the JNDI entry where the destination is bound. However, the actual destination name plays an important role if you want to define some properties across a set of destinations. See the next section Customizing destinations with address settings.

Queues and topics definitions can optionally include some non-mandatory elements, such as selector and durable: <jms-queue name=”selectorQueue”>

<entry name=”/queue/selectorQueue”/>




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

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

Customizing destinations with address settings

If you want to provide some custom settings for JMS destinations, you can use the address-setting block, which can be applied both to a single destination and to a set of them. The default configuration applies a set of minimal attributes to all destinations:


<!–default for catch all–>

<address-setting match=”#”>









Here is a brief description of the addresses settings:

Address-setting’s match attribute defines a filter for the destinations. When using the wildcard “#”, the properties will be valid across all destinations. Other examples:

<address-setting match=”jms.queue.#”>

The settings would apply to all queues defined in the destination section.

<address-setting match=”jms.queue.testQueue “>

The settings would apply to the queue named jms.queue.testQueue.

A short description of the destination’s properties follows here:

configuring jms destinations

HornetQ persistence configuration

The last piece of information we need to cover is about message persistence. HornetQ has its own optimized persistence engine, which can be further tuned when you know all about its building blocks.


The secret of HornetQ’s high-data persistence consists in appending data to the journal files, instead of using the costly random access operations which requires a higher degree of disk-head movement

Journal files are pre-created and filled with padding characters at runtime. By pre-creating files, as one is filled, the journal can immediately resume with the next one without pausing to create it.

The following is the default journal configuration, which ships with JMS subsystem:





The default journal-file-size (expressed in bytes) is 100 KB. The minimum number of files the journal will maintain is indicated by the property journal-min-files, which states that at least two files will be maintained.

The property journal-type indicates the type of input/output libraries used for data persistence. Valid values are NIO or ASYNCIO.

Choosing NIO sets the Java NIO journal. Choosing AIO sets the Linux asynchronous IO journal. If you choose AIO but are not running Linux or you do not have libaio installed, then HornetQ will detect this and automatically fall back to using NIO.

The property persistence-enabled when set to false, will disable message persistence. That means no bindings data, message data, large message data, duplicate ID caches, or paging data will be persisted. Disabling data persistence will give to your applications a remarkable performance boost, however, the other side of it is your data messaging will inevitably lose reliability.

For the sake of completeness, we include some additional properties that can be included if you want to customize the messages/paging and journal storage directories:

<bindings-directory relative-to=”jboss.server.data.dir” path=”hornetq/bindings” />

<large-messages-directory relative-to=”jboss.server.data.dir” path=”hornetq/largemessages” />

<paging-directory relative-to=”jboss.server.data.dir” path=”hornetq/paging” />

<journal-directory relative-to=”jboss.server.data.dir” path=”hornetq/journal” />

For the best performance, we recommend the journal be located on its own physical volume in order to minimize disk-head movement. If the journal is on a volume that is shared with other processes, which might be writing other files (for example, bindings journal, database, or transaction coordinator), then the disk-head may be well moving rapidly between these files as it writes them, thus drastically reducing performance.

0 Responses on Configuring JMS destinations"

Leave a Message

Your email address will not be published. Required fields are marked *

Copy Rights Reserved © Mindmajix.com All rights reserved. Disclaimer.
Course Adviser

Fill your details, course adviser will reach you.