Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
Dynamic queues are queues that are created through the application source code using a vendor-specific API. Administered queues are queues that are defined in the JMS provider configuration files or administration tools.
The setup and configuration of dynamic queues tends to be vendor-specific. A queue may be used exclusively by one consumer or shared by multiple consumers. It may have a size limit (limiting the number of unconsumed messages held in the queue) with options for in-memory storage versus overflow to disk. In addition, a queue may be configured with a vendor-specific addressing syntax or special routing capabilities.
JMS does not attempt to define a set of APIs for all the possible options on a queue. It should be possible to set these options administratively, using the vendor-specific administration capabilities. Most vendors supply a command-line administration tool, a graphical administration tool, or an API for administering queues at runtime. Some vendors supply all three. Using vendor-specific administration APIs to create and configure a queue may be convenient at times. However, it is not very portable and may require that the application have administrator privileges.
JMS provides a QueueSession.createQueue(String queueName) method, but this is not intended to define a new queue in the messaging system. It is intended to return a Queue object that represents an existing queue. There is also a JMS-defined method for creating a temporary queue that can only be consumed by the JMS client that created it using the QueueSession.createTemporaryQueue() method.
Creating dynamic queues is useful if you have a large number of queues that may increase over time. For example, consider the scenario where a book publisher has relationships with a large number of bookstores. The book publisher regularly sends new book information and order status to the bookstores. Let’s assume that there are 1,000 bookstores related to the book publisher. That equates to 1,000 queues—somewhat excessive to administer. The book publisher can dynamically create the bookstore queues based on a numbering scheme, therefore quickly defining the queues necessary for this scenario (e.g., BookstoreQ1, BookstoreQ2, etc.).