JMS API Concepts

From NovaOrdis Knowledge Base
Revision as of 15:25, 21 September 2017 by Ovidiu (talk | contribs) (→‎Destinations)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
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 destination instance, which is an object that incapsulates the name of the destination, 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 destination on the JMS provider, and if the destination 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.