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 Type
    Method
    Description
    void
    Closes all connections in the connection pool.
    javax.jms.Destination
    createQueue(int acknowledgementMode_, String queueName)
    Creates or obtains a JMS Queue.
    javax.jms.Destination
    createQueue(javax.jms.Session topicSession_, String queueName)
    Creates or obtains a JMS Queue on the session provided.
    javax.jms.Destination
    createTopic(int acknowledgementMode_, String topicName_)
    Creates or obtains a JMS Topic.
    javax.jms.Destination
    createTopic(javax.jms.Session topicSession_, String topicName_)
    Creates or obtains a JMS Topic on the session provided.
    javax.jms.Connection
    Creates a new unpooled Connection.
    javax.jms.Connection
    Gets a Connection 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 JMS Session.
    javax.jms.Session
    getSession(javax.jms.Connection connection_, int acknowledgementMode_)
    Gets a JMS TopicSession 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
    getTopic(int acknowledgementMode_, String topicName_)
    Deprecated.
    use createTopic instead for Connection based rather than TopicConnection based JMS.
    javax.jms.Topic
    getTopic(javax.jms.TopicSession topicSession_, String topicName_)
    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 javax.jms.TopicConnection getTopicConnection() throws NamingException, javax.jms.JMSException
      Deprecated.
      use getConnection instead.
      Gets a JMS TopicConnection from the pool.
      Returns:
      the TopicConnection
      Throws:
      NamingException
      javax.jms.JMSException
    • createUnpooledConnection

      javax.jms.Connection createUnpooledConnection() throws NamingException, javax.jms.JMSException
      Creates a new unpooled Connection.
      Returns:
      the Connection
      Throws:
      NamingException
      javax.jms.JMSException
    • getConnection

      javax.jms.Connection getConnection() throws NamingException, javax.jms.JMSException
      Gets a Connection from the pool.
      Returns:
      the Connection
      Throws:
      NamingException
      javax.jms.JMSException
    • getTopicSession

      @Deprecated javax.jms.TopicSession getTopicSession(int acknowledgementMode_) throws NamingException, javax.jms.JMSException
      Deprecated.
      Use getSession instead.
      Gets a JMS TopicSession. Automatically pulls a TopicConnection from the pool and creates a session on that connection.
      Parameters:
      acknowledgementMode_ - the JMS acknowledgement mode to use for subscribers. Can be Session.AUTO_ACKNOWLEDGE, Session.CLIENT_ACKNOWLEDGE, or Session.DUPS_OK_ACKNOWLEDGE
      Returns:
      the TopicSession
      Throws:
      NamingException - if the JMS TopicConnectionFactory cannot be found
      javax.jms.JMSException - if anything goes wrong with the JMS provider
    • getSession

      javax.jms.Session getSession(int acknowledgementMode_) throws NamingException, javax.jms.JMSException
      Gets a JMS Session. Automatically pulls a Connection from the pool and creates a session on that connection.
      Parameters:
      acknowledgementMode_ - the JMS acknowledgement mode to use for subscribers. Can be Session.AUTO_ACKNOWLEDGE, Session.CLIENT_ACKNOWLEDGE, or Session.DUPS_OK_ACKNOWLEDGE
      Returns:
      the TopicSession
      Throws:
      NamingException - if the JMS TopicConnectionFactory cannot be found
      javax.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 JMS TopicSession from the connection passed in.
      Parameters:
      topicConnection_ - the connection to get the session on
      acknowledgementMode_ - the JMS acknowledgement mode to use for subscribers. Can be Session.AUTO_ACKNOWLEDGE, Session.CLIENT_ACKNOWLEDGE, or Session.DUPS_OK_ACKNOWLEDGE
      Returns:
      the TopicSession
      Throws:
      NamingException - if the JMS TopicConnectionFactory cannot be found
      javax.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 JMS TopicSession from the connection passed in.
      Parameters:
      connection_ - the connection to get the session on
      acknowledgementMode_ - the JMS acknowledgement mode to use for subscribers. Can be Session.AUTO_ACKNOWLEDGE, Session.CLIENT_ACKNOWLEDGE, or Session.DUPS_OK_ACKNOWLEDGE
      Returns:
      the TopicSession
      Throws:
      NamingException - if the JMS TopicConnectionFactory cannot be found
      javax.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 JMS Topic. Automatically obtains a session.
      Parameters:
      acknowledgementMode_ - the JMS acknowledgement mode to use for subscribers. Can be Session.AUTO_ACKNOWLEDGE, Session.CLIENT_ACKNOWLEDGE, or Session.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 JMS TopicConnectionFactory cannot be found
      javax.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 JMS Topic. Automatically obtains a session.
      Parameters:
      acknowledgementMode_ - the JMS acknowledgement mode to use for subscribers. Can be Session.AUTO_ACKNOWLEDGE, Session.CLIENT_ACKNOWLEDGE, or Session.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 JMS TopicConnectionFactory cannot be found
      javax.jms.JMSException - if anything goes wrong with the JMS provider
      InvalidJMSDestinationException - 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 JMS Queue. Automatically obtains a session.
      Parameters:
      acknowledgementMode_ - the JMS acknowledgement mode to use for subscribers. Can be Session.AUTO_ACKNOWLEDGE, Session.CLIENT_ACKNOWLEDGE, or Session.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 JMS TopicConnectionFactory cannot be found
      javax.jms.JMSException - if anything goes wrong with the JMS provider
      InvalidJMSDestinationException - 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 JMS Topic on the session provided.
      Parameters:
      topicSession_ - the session to obtain the topic on
      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:
      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 JMS Topic on the session provided.
      Parameters:
      topicSession_ - the session to obtain the topic on
      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:
      javax.jms.JMSException - if anything goes wrong with the JMS provider
      InvalidJMSDestinationException
    • createQueue

      javax.jms.Destination createQueue(javax.jms.Session topicSession_, String queueName) throws javax.jms.JMSException, InvalidJMSDestinationException
      Creates or obtains a JMS Queue on the session provided.
      Parameters:
      topicSession_ - the session to obtain the topic on
      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:
      javax.jms.JMSException - if anything goes wrong with the JMS provider
      InvalidJMSDestinationException
    • 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 JMS TopicSubscriber 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 on
      topic_ - the topic to get the subscriber to
      durableSubscriberName_ - 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 JMS TopicSubscriber 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 on
      topic_ - 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.JMSException
      Closes all connections in the connection pool. This closes both Connections and TopicConnections.
      Throws:
      javax.jms.JMSException - if anything goes wrong with the JMS provider