Destination Administration

Managing the destinations on the JBossMQ server will be the most common task that an administrator will have. This section will explain how to quickly create new queue or topic destinations on a JBossMQ server.

Deployment Overview.

The best way to create a new destination in JBossMQ is to “deploy” the destination via JMX, the same way that all the other JBossMQ server components are deployed.

You do this by creating a new JBoss service descriptor file and defining the new destinations that you wish to create within that file.

The JBoss service descriptor filename must end in -service.xml. To deploy the descriptor file, you only need to copy the file to the JBoss /deploy directory.

The deploy/jbossmq-destinations-service.xml is the deployment descriptor that defines the default JBossMQ destinations..

Deploying a Queue

Lets say that you need to create a new queue called ‘POInbox’. To create that queue, you would follow the following steps:

  1. Create a poinbox-service.xml file.

  2. Fill it in with the following:

<server>
<mbean code="org.jboss.mq.server.jmx.Queue"
name="jboss.mq.destination:service=Queue,name=POInbox">
<depends optional-attribute-name="DestinationManager">
jboss.mq:service=DestinationManager
</depends>
</mbean>
</server>
  1. Copy the file to the /deploy directory of the JBoss server.

If the server was already running and you were looking at the server logs, you should see output similar to the following showing that the queue was deployed successfully:

15:31:27,473
INFO [MainDeployer] Starting deployment of package:
file:/C:/java/jboss-3.2.0RC4/server/default/deploy/poinbox-service.xml
15:31:27,483 INFO [SARDeployer] looking for nested deployments in :
file:/C:/java/jboss-3.2.0RC4/server/default/deploy/poinbox-service.xml
15:31:27,503 INFO [POInbox] Creating
15:31:27,513 INFO [POInbox] Created
15:31:27,523 INFO [POInbox] Starting
15:31:27,533 INFO [POInbox] Bound to JNDI name: queue/POInbox
15:31:27,533 INFO [POInbox] Started
15:31:27,553 INFO [MainDeployer] Deployed package:
file:/C:/java/jboss-3.2.0RC4/server/default/deploy/poinbox-service.xml

Once a queue has been deployed it will be bound in JNDI. The queue destination in our example can be looked up using the queue/POInbox JNDI name.

Deploying a Topic

The procedure for deploying a topic is very similar to what was used to deploy a queue.

Let's say that you need to create a new topic called ‘POEvents’. To create that topic, you would follow the following steps:

  1. Create a poevent-service.xml file.

  2. Fill it in with the following:

<server>
<mbean code="org.jboss.mq.server.jmx.Topic"
name="jboss.mq.destination:service=Topic,name=POEvents">
<depends optional-attribute-name="DestinationManager">
jboss.mq:service=DestinationManager
</depends>
</mbean>
</server>
  1. Copy the file to the /deploy directory of the JBoss server.

If the server was already running and you were looking at the server logs, you should see output dispalying that the topic was deployed successfully,similar to the following:

16:06:15,075 INFO [SARDeployer] looking for nested deployments in :
file:/C:/java/jboss-3.2.0RC4/server/default/deploy/poevent-service.xml
16:06:15,085 INFO [POEvents] Creating
16:06:15,085 INFO [POEvents] Created
16:06:15,085 INFO [POEvents] Starting
16:06:15,095 INFO [POEvents] Bound to JNDI name: topic/POEvents
16:06:15,095 INFO [POEvents] Started
16:06:15,115 INFO [MainDeployer] Deployed package:
file:/C:/java/jboss-3.2.0RC4/server/default/deploy/poevent-service.xml

Once a topic has been deployed it will be bound in JNDI. The topic destination in our example can be looked using the topic/POEvents JNDI name.

Undeploying a Destination

If you want to take a queue or topic offline, all you have to do is remove the deployment descriptor xml file that defines the destination from the /deploy directory. Once the destination is undeployed, the destination will not be accessible to clients.

It is important to remember that when a destination is undeployed, it is not destroyed. The next time you deploy the destination, it will still hold the same messages that it was holding when it was undeployed.