Class SQSConnectionFactory

java.lang.Object
com.amazon.sqs.javamessaging.SQSConnectionFactory
All Implemented Interfaces:
jakarta.jms.ConnectionFactory, jakarta.jms.QueueConnectionFactory

public class SQSConnectionFactory extends Object implements jakarta.jms.ConnectionFactory, jakarta.jms.QueueConnectionFactory
A ConnectionFactory object encapsulates a set of connection configuration parameters for AmazonSQSClient as well as setting numberOfMessagesToPrefetch.

The numberOfMessagesToPrefetch parameter is used to size of the prefetched messages, which can be tuned based on the application workload. It helps in returning messages from internal buffers(if there is any) instead of waiting for the SQS receiveMessage call to return.

If more physical connections than the default maximum value (that is 50 as of today) are needed on the connection pool, ClientConfiguration needs to be configured.

None of the createConnection methods set-up the physical connection to SQS, so validity of credentials are not checked with those methods.

  • Constructor Details

    • SQSConnectionFactory

      public SQSConnectionFactory(ProviderConfiguration providerConfiguration)
    • SQSConnectionFactory

      public SQSConnectionFactory(ProviderConfiguration providerConfiguration, com.amazonaws.services.sqs.AmazonSQS client)
    • SQSConnectionFactory

      public SQSConnectionFactory(ProviderConfiguration providerConfiguration, com.amazonaws.services.sqs.AmazonSQSClientBuilder clientBuilder)
  • Method Details

    • createConnection

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

      public SQSConnection createConnection(String awsAccessKeyId, String awsSecretKey) throws jakarta.jms.JMSException
      Specified by:
      createConnection in interface jakarta.jms.ConnectionFactory
      Throws:
      jakarta.jms.JMSException
    • createConnection

      public SQSConnection createConnection(com.amazonaws.auth.AWSCredentials awsCredentials) throws jakarta.jms.JMSException
      Throws:
      jakarta.jms.JMSException
    • createConnection

      public SQSConnection createConnection(com.amazonaws.auth.AWSCredentialsProvider awsCredentialsProvider) throws jakarta.jms.JMSException
      Throws:
      jakarta.jms.JMSException
    • createContext

      public jakarta.jms.JMSContext createContext()
      This method is not supported.
      Specified by:
      createContext in interface jakarta.jms.ConnectionFactory
    • createContext

      public jakarta.jms.JMSContext createContext(String userName, String password)
      This method is not supported.
      Specified by:
      createContext in interface jakarta.jms.ConnectionFactory
    • createContext

      public jakarta.jms.JMSContext createContext(String userName, String password, int sessionMode)
      This method is not supported.
      Specified by:
      createContext in interface jakarta.jms.ConnectionFactory
    • createContext

      public jakarta.jms.JMSContext createContext(int sessionMode)
      This method is not supported.
      Specified by:
      createContext in interface jakarta.jms.ConnectionFactory
    • 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
    • builder

      @Deprecated public static SQSConnectionFactory.Builder builder()
      Deprecated.
      Deprecated. Use one of the constructors of this class instead and provide either AmazonSQS client or AmazonSQSClientBuilder.