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 TypeMethodDescriptionvoidCloses all connections in the connection pool.javax.jms.DestinationcreateQueue(int acknowledgementMode_, String queueName) Creates or obtains a JMSQueue.javax.jms.DestinationcreateQueue(javax.jms.Session topicSession_, String queueName) Creates or obtains a JMSQueueon the session provided.javax.jms.DestinationcreateTopic(int acknowledgementMode_, String topicName_) Creates or obtains a JMSTopic.javax.jms.DestinationcreateTopic(javax.jms.Session topicSession_, String topicName_) Creates or obtains a JMSTopicon the session provided.javax.jms.ConnectionCreates a new unpooledConnection.javax.jms.ConnectionGets aConnectionfrom the pool.javax.jms.TopicPublishergetPublisher(javax.jms.TopicSession topicSession_, javax.jms.Topic topic_) Deprecated.Use instead session.createProducer(destination);javax.jms.SessiongetSession(int acknowledgementMode_) Gets a JMSSession.javax.jms.SessiongetSession(javax.jms.Connection connection_, int acknowledgementMode_) Gets a JMSTopicSessionfrom the connection passed in.javax.jms.TopicSubscribergetSubscriber(javax.jms.TopicSession topicSession_, javax.jms.Topic topic_, String durableSubscriberName_) Deprecated.Use instead session.createDurableSubscriber(topic,durableSubscriberName)javax.jms.TopicDeprecated.use createTopic instead for Connection based rather than TopicConnection based JMS.javax.jms.TopicDeprecated.use createTopic instead for Connection based rather than TopicConnection based JMS.javax.jms.TopicConnectionDeprecated.use getConnection instead.javax.jms.TopicSessiongetTopicSession(int acknowledgementMode_) Deprecated.Use getSession instead.javax.jms.TopicSessiongetTopicSession(javax.jms.TopicConnection topicConnection_, int acknowledgementMode_) Deprecated.Use getSession instead.
-
Method Details
-
getTopicConnection
@Deprecated javax.jms.TopicConnection getTopicConnection() throws NamingException, javax.jms.JMSExceptionDeprecated.use getConnection instead.Gets a JMSTopicConnectionfrom the pool.- Returns:
- the
TopicConnection - Throws:
NamingExceptionjavax.jms.JMSException
-
createUnpooledConnection
Creates a new unpooledConnection.- Returns:
- the
Connection - Throws:
NamingExceptionjavax.jms.JMSException
-
getConnection
Gets aConnectionfrom the pool.- Returns:
- the
Connection - Throws:
NamingExceptionjavax.jms.JMSException
-
getTopicSession
@Deprecated javax.jms.TopicSession getTopicSession(int acknowledgementMode_) throws NamingException, javax.jms.JMSException Deprecated.Use getSession instead.Gets a JMSTopicSession. Automatically pulls aTopicConnectionfrom 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 JMSTopicConnectionFactorycannot 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 aConnectionfrom 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 JMSTopicConnectionFactorycannot be foundjavax.jms.JMSException- if anything goes wrong with the JMS provider
-
getTopicSession
@Deprecated javax.jms.TopicSession getTopicSession(javax.jms.TopicConnection topicConnection_, int acknowledgementMode_) throws NamingException, javax.jms.JMSException Deprecated.Use getSession instead.Gets a JMSTopicSessionfrom 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 JMSTopicConnectionFactorycannot 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 JMSTopicSessionfrom 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 JMSTopicConnectionFactorycannot be foundjavax.jms.JMSException- if anything goes wrong with the JMS provider
-
getTopic
@Deprecated 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_ACKNOWLEDGEtopicName_- 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 JMSTopicConnectionFactorycannot 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_ACKNOWLEDGEtopicName_- 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
Topicas Destination; if the JNDI name already exists, any type of Destination may be returned - Throws:
NamingException- if the JMSTopicConnectionFactorycannot 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_ACKNOWLEDGEqueueName- 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
Queueas Destination; if the JNDI name already exists, any type of Destination may be returned - Throws:
NamingException- if the JMSTopicConnectionFactorycannot be foundjavax.jms.JMSException- if anything goes wrong with the JMS providerInvalidJMSDestinationException- if the queue cannot be created
-
getTopic
@Deprecated 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 JMSTopicon 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 JMSTopicon 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
Topicas 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 JMSQueueon 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
Queueas 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
@Deprecated 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 JMSTopicSubscriberon 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
@Deprecated 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 JMSTopicSubscriberon 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
-