Application queues can be created on the Messaging Engine component for use with point-to-point messaging.
There are three types of queues:
- Static queues, which are configured through the Administrative API.
- Dynamic queues, which are created automatically on "first use" by an application. The dynamic queues feature is intended to dramatically reduce queue administration, and means that a point-to-point JMS application can simply start sending or receiving messages from a queue. The broker creates that queue if it does not already exist.
- Temporary queues, which are created through JMS application code, and survive for the lifetime of the JMS connection.
The key difference between the three types of queues is their life cycle. A statically created queue will exist on the broker until it is administratively deleted. A dynamically created queue will be expired (deleted) automatically if it is empty and not opened for a certain, configurable period. The default period is 28 days. Expiring queues helps make more efficient use of broker resources, and no messages will be lost, since the queue will only be expired if it is empty. Any applications attempting to use the queue after expiry will cause it to be re-created.
Using the MessagingEngine component from the Administrative API, you can retrieve information on all three types of queues, and perform other operations, such as clearing messages off the queue and deleting queue entirely.
The following is example code to create a static queue, changing the default queue depth to 2000 messages:
MessagingEngine messagingEngine = broker.getMessagingEngine();
QueueDefinition queueDefinition = messagingEngine.createQueueDefinition("MyQueue");
Parent topic: Configuring and administering micro broker components: XPD621