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
ConstructorsConstructorDescriptionSQSConnectionFactory
(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.JMSContext
jakarta.jms.JMSContext
createContext
(int sessionMode) jakarta.jms.JMSContext
createContext
(String userName, String password) jakarta.jms.JMSContext
createContext
(String userName, String password, int sessionMode) jakarta.jms.QueueConnection
jakarta.jms.QueueConnection
createQueueConnection
(String userName, String password)
-
Constructor Details
-
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:
createConnection
in interfacejakarta.jms.ConnectionFactory
- Throws:
jakarta.jms.JMSException
-
createConnection
public SQSConnection createConnection(String awsAccessKeyId, String awsSecretKey) throws jakarta.jms.JMSException - Specified by:
createConnection
in interfacejakarta.jms.ConnectionFactory
- Throws:
jakarta.jms.JMSException
-
createContext
public jakarta.jms.JMSContext createContext()- Specified by:
createContext
in interfacejakarta.jms.ConnectionFactory
-
createContext
- Specified by:
createContext
in interfacejakarta.jms.ConnectionFactory
-
createContext
- Specified by:
createContext
in interfacejakarta.jms.ConnectionFactory
-
createContext
public jakarta.jms.JMSContext createContext(int sessionMode) - Specified by:
createContext
in 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:
createQueueConnection
in interfacejakarta.jms.QueueConnectionFactory
- Throws:
jakarta.jms.JMSException
-
createQueueConnection
public jakarta.jms.QueueConnection createQueueConnection(String userName, String password) throws jakarta.jms.JMSException - Specified by:
createQueueConnection
in interfacejakarta.jms.QueueConnectionFactory
- Throws:
jakarta.jms.JMSException
-