Interface JmsConnectionFactory
public interface JmsConnectionFactory
Factory for obtaining JMS connections from the JMS connection pool.
The connection pool can be configured in jms.properties and jndi.properties.
This interface supports both old TopicConnection and new Connection based
access. The TopicConnection based access has been deprecated in favor
of Connection based methods, which are capable of working with both
Topics and Queues.
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Closes all connections in the connection pool.javax.jms.Destination
createQueue
(int acknowledgementMode_, String queueName) Creates or obtains a JMSQueue
.javax.jms.Destination
createQueue
(javax.jms.Session topicSession_, String queueName) Creates or obtains a JMSQueue
on the session provided.javax.jms.Destination
createTopic
(int acknowledgementMode_, String topicName_) Creates or obtains a JMSTopic
.javax.jms.Destination
createTopic
(javax.jms.Session topicSession_, String topicName_) Creates or obtains a JMSTopic
on the session provided.javax.jms.Connection
Creates a new unpooledConnection
.javax.jms.Connection
Gets aConnection
from the pool.javax.jms.TopicPublisher
getPublisher
(javax.jms.TopicSession topicSession_, javax.jms.Topic topic_) Deprecated.Use instead session.createProducer(destination);javax.jms.Session
getSession
(int acknowledgementMode_) Gets a JMSSession
.javax.jms.Session
getSession
(javax.jms.Connection connection_, int acknowledgementMode_) Gets a JMSTopicSession
from the connection passed in.javax.jms.TopicSubscriber
getSubscriber
(javax.jms.TopicSession topicSession_, javax.jms.Topic topic_, String durableSubscriberName_) Deprecated.Use instead session.createDurableSubscriber(topic,durableSubscriberName)javax.jms.Topic
Deprecated.use createTopic instead for Connection based rather than TopicConnection based JMS.javax.jms.Topic
Deprecated.use createTopic instead for Connection based rather than TopicConnection based JMS.javax.jms.TopicConnection
Deprecated.use getConnection instead.javax.jms.TopicSession
getTopicSession
(int acknowledgementMode_) Deprecated.Use getSession instead.javax.jms.TopicSession
getTopicSession
(javax.jms.TopicConnection topicConnection_, int acknowledgementMode_) Deprecated.Use getSession instead.
-
Method Details
-
getTopicConnection
Deprecated.use getConnection instead.Gets a JMSTopicConnection
from the pool.- Returns:
- the
TopicConnection
- Throws:
NamingException
javax.jms.JMSException
-
createUnpooledConnection
Creates a new unpooledConnection
.- Returns:
- the
Connection
- Throws:
NamingException
javax.jms.JMSException
-
getConnection
Gets aConnection
from the pool.- Returns:
- the
Connection
- Throws:
NamingException
javax.jms.JMSException
-
getTopicSession
javax.jms.TopicSession getTopicSession(int acknowledgementMode_) throws NamingException, javax.jms.JMSException Deprecated.Use getSession instead.Gets a JMSTopicSession
. Automatically pulls aTopicConnection
from the pool and creates a session on that connection.- Parameters:
acknowledgementMode_
- the JMS acknowledgement mode to use for subscribers. Can beSession.AUTO_ACKNOWLEDGE
,Session.CLIENT_ACKNOWLEDGE
, orSession.DUPS_OK_ACKNOWLEDGE
- Returns:
- the
TopicSession
- Throws:
NamingException
- if the JMSTopicConnectionFactory
cannot be foundjavax.jms.JMSException
- if anything goes wrong with the JMS provider
-
getSession
javax.jms.Session getSession(int acknowledgementMode_) throws NamingException, javax.jms.JMSException Gets a JMSSession
. Automatically pulls aConnection
from the pool and creates a session on that connection.- Parameters:
acknowledgementMode_
- the JMS acknowledgement mode to use for subscribers. Can beSession.AUTO_ACKNOWLEDGE
,Session.CLIENT_ACKNOWLEDGE
, orSession.DUPS_OK_ACKNOWLEDGE
- Returns:
- the
TopicSession
- Throws:
NamingException
- if the JMSTopicConnectionFactory
cannot be foundjavax.jms.JMSException
- if anything goes wrong with the JMS provider
-
getTopicSession
javax.jms.TopicSession getTopicSession(javax.jms.TopicConnection topicConnection_, int acknowledgementMode_) throws NamingException, javax.jms.JMSException Deprecated.Use getSession instead.Gets a JMSTopicSession
from the connection passed in.- Parameters:
topicConnection_
- the connection to get the session onacknowledgementMode_
- the JMS acknowledgement mode to use for subscribers. Can beSession.AUTO_ACKNOWLEDGE
,Session.CLIENT_ACKNOWLEDGE
, orSession.DUPS_OK_ACKNOWLEDGE
- Returns:
- the
TopicSession
- Throws:
NamingException
- if the JMSTopicConnectionFactory
cannot be foundjavax.jms.JMSException
- if anything goes wrong with the JMS provider
-
getSession
javax.jms.Session getSession(javax.jms.Connection connection_, int acknowledgementMode_) throws NamingException, javax.jms.JMSException Gets a JMSTopicSession
from the connection passed in.- Parameters:
connection_
- the connection to get the session onacknowledgementMode_
- the JMS acknowledgement mode to use for subscribers. Can beSession.AUTO_ACKNOWLEDGE
,Session.CLIENT_ACKNOWLEDGE
, orSession.DUPS_OK_ACKNOWLEDGE
- Returns:
- the
TopicSession
- Throws:
NamingException
- if the JMSTopicConnectionFactory
cannot be foundjavax.jms.JMSException
- if anything goes wrong with the JMS provider
-
getTopic
javax.jms.Topic getTopic(int acknowledgementMode_, String topicName_) throws NamingException, javax.jms.JMSException Deprecated.use createTopic instead for Connection based rather than TopicConnection based JMS.Gets a JMSTopic
. Automatically obtains a session.- Parameters:
acknowledgementMode_
- the JMS acknowledgement mode to use for subscribers. Can beSession.AUTO_ACKNOWLEDGE
,Session.CLIENT_ACKNOWLEDGE
, orSession.DUPS_OK_ACKNOWLEDGE
topicName_
- the name of the topic. When the topic is obtained, the system-wide topic prefix (located in jms.properties) will automatically be appended- Returns:
- the
Topic
- Throws:
NamingException
- if the JMSTopicConnectionFactory
cannot be foundjavax.jms.JMSException
- if anything goes wrong with the JMS provider
-
createTopic
javax.jms.Destination createTopic(int acknowledgementMode_, String topicName_) throws NamingException, javax.jms.JMSException, InvalidJMSDestinationException Creates or obtains a JMSTopic
. Automatically obtains a session.- Parameters:
acknowledgementMode_
- the JMS acknowledgement mode to use for subscribers. Can beSession.AUTO_ACKNOWLEDGE
,Session.CLIENT_ACKNOWLEDGE
, orSession.DUPS_OK_ACKNOWLEDGE
topicName_
- the name of the topic. When the topic is obtained, the system-wide topic prefix (located in jms.properties) will automatically be appended- Returns:
- the
Topic
as Destination; if the JNDI name already exists, any type of Destination may be returned - Throws:
NamingException
- if the JMSTopicConnectionFactory
cannot be foundjavax.jms.JMSException
- if anything goes wrong with the JMS providerInvalidJMSDestinationException
- if the topic cannot be created
-
createQueue
javax.jms.Destination createQueue(int acknowledgementMode_, String queueName) throws NamingException, javax.jms.JMSException, InvalidJMSDestinationException Creates or obtains a JMSQueue
. Automatically obtains a session.- Parameters:
acknowledgementMode_
- the JMS acknowledgement mode to use for subscribers. Can beSession.AUTO_ACKNOWLEDGE
,Session.CLIENT_ACKNOWLEDGE
, orSession.DUPS_OK_ACKNOWLEDGE
queueName
- the name of the queue. When the queue is obtained, the system-wide queue prefix (located in jms.properties) will automatically be appended- Returns:
- the
Queue
as Destination; if the JNDI name already exists, any type of Destination may be returned - Throws:
NamingException
- if the JMSTopicConnectionFactory
cannot be foundjavax.jms.JMSException
- if anything goes wrong with the JMS providerInvalidJMSDestinationException
- if the queue cannot be created
-
getTopic
javax.jms.Topic getTopic(javax.jms.TopicSession topicSession_, String topicName_) throws javax.jms.JMSException Deprecated.use createTopic instead for Connection based rather than TopicConnection based JMS.Gets a JMSTopic
on the session provided.- Parameters:
topicSession_
- the session to obtain the topic ontopicName_
- the name of the topic. When the topic is obtained, the system-wide topic prefix (located in jms.properties) will automatically be appended- Returns:
- the
Topic
- Throws:
javax.jms.JMSException
- if anything goes wrong with the JMS provider
-
createTopic
javax.jms.Destination createTopic(javax.jms.Session topicSession_, String topicName_) throws javax.jms.JMSException, InvalidJMSDestinationException Creates or obtains a JMSTopic
on the session provided.- Parameters:
topicSession_
- the session to obtain the topic ontopicName_
- the name of the topic. When the topic is obtained, the system-wide topic prefix (located in jms.properties) will automatically be appended- Returns:
- the
Topic
as Destination; if the JNDI name already exists, any type of Destination may be returned - Throws:
javax.jms.JMSException
- if anything goes wrong with the JMS providerInvalidJMSDestinationException
-
createQueue
javax.jms.Destination createQueue(javax.jms.Session topicSession_, String queueName) throws javax.jms.JMSException, InvalidJMSDestinationException Creates or obtains a JMSQueue
on the session provided.- Parameters:
topicSession_
- the session to obtain the topic onqueueName
- the name of the queue. When the queue is obtained, the system-wide queue prefix (located in jms.properties) will automatically be appended- Returns:
- the
Queue
as Destination; if the JNDI name already exists, any type of Destination may be returned - Throws:
javax.jms.JMSException
- if anything goes wrong with the JMS providerInvalidJMSDestinationException
-
getSubscriber
javax.jms.TopicSubscriber getSubscriber(javax.jms.TopicSession topicSession_, javax.jms.Topic topic_, String durableSubscriberName_) throws javax.jms.JMSException Deprecated.Use instead session.createDurableSubscriber(topic,durableSubscriberName)Gets a durable JMSTopicSubscriber
on the session provided to the topic provided. Sets the durable subscriber name to the name provided.- Parameters:
topicSession_
- the session to get the subscriber ontopic_
- the topic to get the subscriber todurableSubscriberName_
- the name of the durable subscriber- Returns:
- the
TopicSubscriber
- Throws:
javax.jms.JMSException
- if anything goes wrong with the JMS provider
-
getPublisher
javax.jms.TopicPublisher getPublisher(javax.jms.TopicSession topicSession_, javax.jms.Topic topic_) throws javax.jms.JMSException Deprecated.Use instead session.createProducer(destination);Gets a non-durable JMSTopicSubscriber
on the session provided to the topic provided. Sets the durable subscriber name to the name provided.- Parameters:
topicSession_
- the session to get the subscriber ontopic_
- the topic to get the subscriber to- Returns:
- the
TopicSubscriber
- Throws:
javax.jms.JMSException
- if anything goes wrong with the JMS provider
-
closeAllConnections
void closeAllConnections() throws javax.jms.JMSExceptionCloses all connections in the connection pool. This closes both Connections and TopicConnections.- Throws:
javax.jms.JMSException
- if anything goes wrong with the JMS provider
-