JMS API Concepts: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
 
(One intermediate revision by the same user not shown)
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.  


session.createQueue(queueName);
<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 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.

Latest revision as of 15:25, 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 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.