Class ServiceBusJmsConnectionFactory

java.lang.Object
com.azure.servicebus.jms.jndi.JNDIStorable
com.azure.servicebus.jms.ServiceBusJmsConnectionFactory
All Implemented Interfaces:
jakarta.jms.ConnectionFactory, jakarta.jms.QueueConnectionFactory, jakarta.jms.TopicConnectionFactory, Referenceable
Direct Known Subclasses:
ServiceBusJmsQueueConnectionFactory, ServiceBusJmsTopicConnectionFactory

public class ServiceBusJmsConnectionFactory extends JNDIStorable implements jakarta.jms.ConnectionFactory, jakarta.jms.QueueConnectionFactory, jakarta.jms.TopicConnectionFactory
  • Constructor Details

    • ServiceBusJmsConnectionFactory

      public ServiceBusJmsConnectionFactory()
      Intended to be used by JNDI only. Users should not be actively calling this constructor to create a ServiceBusJmsConnectionFactory instance. So far only use by JNDIConnectionFactoryTests.
    • ServiceBusJmsConnectionFactory

      public ServiceBusJmsConnectionFactory(String connectionString, ServiceBusJmsConnectionFactorySettings settings)
      Create a ServiceBusJmsConnectionFactory using a given Azure ServiceBus connection string.
      Parameters:
      connectionString - The ServiceBus connection string. For details on how to get your connection string, please see https://docs.microsoft.com/en-us/azure/service-bus-messaging/service-bus-create-namespace-portal#get-the-connection-string.
      settings - The options used for this ConnectionFactory. Null can be used as default.
    • ServiceBusJmsConnectionFactory

      public ServiceBusJmsConnectionFactory(ConnectionStringBuilder connectionStringBuilder, ServiceBusJmsConnectionFactorySettings settings)
      Create a ServiceBusJmsConnectionFactory using a given Azure ServiceBus ConnectionStringBuilder.
      Parameters:
      connectionStringBuilder - The ConnectionStringBuilder constructed using the SerivceBus connection string
      settings - The options used for this ConnectionFactory. Null can be used as default.
    • ServiceBusJmsConnectionFactory

      public ServiceBusJmsConnectionFactory(String sasKeyName, String sasKey, String host, ServiceBusJmsConnectionFactorySettings settings)
      Create a ServiceBusJmsConnectionFactory using shared access key and host name.
      Parameters:
      sasKeyName - The Shared access policy name.
      sasKey - The Shared access policy key.
      host - The host name of the ServiceBus namespace. Example: your-namespace-name.servicebus.windows.net
      settings - The options used for this ConnectionFactory. Null can be used as default.
    • ServiceBusJmsConnectionFactory

      public ServiceBusJmsConnectionFactory(com.azure.core.credential.TokenCredential credential, String host, ServiceBusJmsConnectionFactorySettings settings)
      Create a ServiceBusJmsConnectionFactory using a credential and host name.
      Parameters:
      credential - . A token provider credential that will be used to acquire an aad token.
      host - . The host name of the ServiceBus namespace. Example: your-namespace-name.servicebus.windows.net
      settings - The options used for this ConnectionFactory. Null can be used as default.
  • Method Details

    • getConnectionStringBuilder

      public ConnectionStringBuilder getConnectionStringBuilder()
    • getClientId

      public String getClientId()
      Returns:
      The clientId set for this ConnectionFactory.
    • setClientId

      public void setClientId(String clientId)
      Parameters:
      clientId - Set the clientId for this ConnectionFactory. Connections created with this ConnectionFactory will have this value as its clientId.
    • getSettings

      Returns:
      The ServiceBusConnectionFactorySettings used to initialize this ServiceBusJmsConnectionFactory
    • getRemoteConnectionUri

      public String getRemoteConnectionUri()
    • getPrefetchPolicy

      public org.apache.qpid.jms.policy.JmsPrefetchPolicy getPrefetchPolicy()
    • createConnection

      public jakarta.jms.Connection createConnection() throws jakarta.jms.JMSException
      Specified by:
      createConnection in interface jakarta.jms.ConnectionFactory
      Throws:
      jakarta.jms.JMSException
    • createConnection

      public jakarta.jms.Connection createConnection(String userName, String password) throws jakarta.jms.JMSException
      Specified by:
      createConnection in interface jakarta.jms.ConnectionFactory
      Throws:
      jakarta.jms.JMSException
    • createContext

      public jakarta.jms.JMSContext createContext()
      Specified by:
      createContext in interface jakarta.jms.ConnectionFactory
    • createContext

      public jakarta.jms.JMSContext createContext(int sessionMode)
      Specified by:
      createContext in interface jakarta.jms.ConnectionFactory
    • createContext

      public jakarta.jms.JMSContext createContext(String userName, String password)
      Specified by:
      createContext in interface jakarta.jms.ConnectionFactory
    • createContext

      public jakarta.jms.JMSContext createContext(String userName, String password, int sessionMode)
      Specified by:
      createContext in interface jakarta.jms.ConnectionFactory
    • createTopicConnection

      public jakarta.jms.TopicConnection createTopicConnection() throws jakarta.jms.JMSException
      Specified by:
      createTopicConnection in interface jakarta.jms.TopicConnectionFactory
      Throws:
      jakarta.jms.JMSException
    • createTopicConnection

      public jakarta.jms.TopicConnection createTopicConnection(String userName, String password) throws jakarta.jms.JMSException
      Specified by:
      createTopicConnection in interface jakarta.jms.TopicConnectionFactory
      Throws:
      jakarta.jms.JMSException
    • createQueueConnection

      public jakarta.jms.QueueConnection createQueueConnection() throws jakarta.jms.JMSException
      Specified by:
      createQueueConnection in interface jakarta.jms.QueueConnectionFactory
      Throws:
      jakarta.jms.JMSException
    • createQueueConnection

      public jakarta.jms.QueueConnection createQueueConnection(String userName, String password) throws jakarta.jms.JMSException
      Specified by:
      createQueueConnection in interface jakarta.jms.QueueConnectionFactory
      Throws:
      jakarta.jms.JMSException
    • getProperties

      protected Map<String,String> getProperties()
      Specified by:
      getProperties in class JNDIStorable
    • setProperties

      protected void setProperties(Map<String,String> properties)
      Specified by:
      setProperties in class JNDIStorable
    • getCustomUserAgent

      protected String getCustomUserAgent()
    • setCustomUserAgent

      protected void setCustomUserAgent(String customUserAgent)