JMS API Concepts

From NovaOrdis Knowledge Base
Revision as of 15:24, 21 September 2017 by Ovidiu (talk | contribs)
Jump to navigation Jump to search

Internal

Destinations

JMS has a feature that allows dynamic "creation" of destination representations on the client, as an alternative to JNDI lookup.

session.createQueue(queueName);

The method is a mean of creating a provider-specific Queue instance, which is an object that incapsulates the name of the queue, instead of looking it up in JNDI. The returned object is similar to the instance retuned from JNDI. The documentation specifically advises against using this method, in favor of JNDI lookups. An active session is required. The method does not actually create the physical queue on the JMS provider, and if the queue is not available, the method throws a JMSException with a "There is no queue with name ..." message, or similar. More details https://docs.oracle.com/javaee/7/api/javax/jms/Session.html.