Package com.amazon.sqs.javamessaging
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
SqsClient 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,
ClientOverrideConfiguration 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 Summary
ConstructorsConstructorDescriptionCreates a SQSConnectionFactory that uses default ProviderConfiguration and SqsClientBuilder.standard() for creating SqsClient connections.SQSConnectionFactory(ProviderConfiguration providerConfiguration) Creates a SQSConnectionFactory that uses SqsClientBuilder.standard() for creating SqsClient connections.SQSConnectionFactory(ProviderConfiguration providerConfiguration, software.amazon.awssdk.services.sqs.SqsClient client) Creates a SQSConnectionFactory that uses the provided SqsClient connection.SQSConnectionFactory(ProviderConfiguration providerConfiguration, software.amazon.awssdk.services.sqs.SqsClientBuilder clientBuilder) Creates a SQSConnectionFactory that uses the provided SqsClientBuilder for creating AmazonSQS client connections. -
Method Summary
Modifier and TypeMethodDescriptioncreateConnection(String awsAccessKeyId, String awsSecretKey) createConnection(software.amazon.awssdk.auth.credentials.AwsCredentials awsCredentials) createConnection(software.amazon.awssdk.auth.credentials.AwsCredentialsProvider awsCredentialsProvider) jakarta.jms.JMSContextjakarta.jms.JMSContextcreateContext(int sessionMode) jakarta.jms.JMSContextcreateContext(String userName, String password) jakarta.jms.JMSContextcreateContext(String userName, String password, int sessionMode) jakarta.jms.QueueConnectionjakarta.jms.QueueConnectioncreateQueueConnection(String userName, String password)
-
Constructor Details
-
SQSConnectionFactory
public SQSConnectionFactory()Creates a SQSConnectionFactory that uses default ProviderConfiguration and SqsClientBuilder.standard() for creating SqsClient connections. Every SQSConnection will have its own copy of SqsClient. -
SQSConnectionFactory
Creates a SQSConnectionFactory that uses SqsClientBuilder.standard() for creating SqsClient connections. Every SQSConnection will have its own copy of SqsClient. -
SQSConnectionFactory
public SQSConnectionFactory(ProviderConfiguration providerConfiguration, software.amazon.awssdk.services.sqs.SqsClient client) Creates a SQSConnectionFactory that uses the provided SqsClient connection. Every SQSConnection will use the same provided SqsClient. -
SQSConnectionFactory
public SQSConnectionFactory(ProviderConfiguration providerConfiguration, software.amazon.awssdk.services.sqs.SqsClientBuilder clientBuilder) Creates a SQSConnectionFactory that uses the provided SqsClientBuilder for creating AmazonSQS client connections. Every SQSConnection will have its own copy of AmazonSQS client created through the provided builder.
-
-
Method Details
-
createConnection
- Specified by:
createConnectionin interfacejakarta.jms.ConnectionFactory- Throws:
jakarta.jms.JMSException
-
createConnection
public SQSConnection createConnection(String awsAccessKeyId, String awsSecretKey) throws jakarta.jms.JMSException - Specified by:
createConnectionin interfacejakarta.jms.ConnectionFactory- Throws:
jakarta.jms.JMSException
-
createContext
public jakarta.jms.JMSContext createContext()- Specified by:
createContextin interfacejakarta.jms.ConnectionFactory
-
createContext
- Specified by:
createContextin interfacejakarta.jms.ConnectionFactory
-
createContext
- Specified by:
createContextin interfacejakarta.jms.ConnectionFactory
-
createContext
public jakarta.jms.JMSContext createContext(int sessionMode) - Specified by:
createContextin interfacejakarta.jms.ConnectionFactory
-
createConnection
public SQSConnection createConnection(software.amazon.awssdk.auth.credentials.AwsCredentials awsCredentials) throws jakarta.jms.JMSException - Throws:
jakarta.jms.JMSException
-
createConnection
public SQSConnection createConnection(software.amazon.awssdk.auth.credentials.AwsCredentialsProvider awsCredentialsProvider) throws jakarta.jms.JMSException - Throws:
jakarta.jms.JMSException
-
createQueueConnection
public jakarta.jms.QueueConnection createQueueConnection() throws jakarta.jms.JMSException- Specified by:
createQueueConnectionin interfacejakarta.jms.QueueConnectionFactory- Throws:
jakarta.jms.JMSException
-
createQueueConnection
public jakarta.jms.QueueConnection createQueueConnection(String userName, String password) throws jakarta.jms.JMSException - Specified by:
createQueueConnectionin interfacejakarta.jms.QueueConnectionFactory- Throws:
jakarta.jms.JMSException
-