JMS API Concepts: Difference between revisions
No edit summary |
|||
Line 4: | Line 4: | ||
=Destinations= | =Destinations= | ||
JMS has a feature that allows dynamic "creation" of destination representations on the client, as an alternative to JNDI lookup. | JMS has a feature that allows dynamic "creation" of destination representations on the client, as an alternative to JNDI lookup. | ||
<syntaxhighlight lang='java'> | |||
session.createQueue(queueName); | |||
</syntaxhighlight> | |||
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. | 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. |
Revision as of 15:24, 21 September 2017
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.