Describe the story
Create a SQS client utility which serves as a wrapper around the AWS SDK SQSClient. This should simplify the creation of the AWS SDK SQS client and it should store the created instance as a singleton for reuse across Lambda function invocations.
The wrapper should provide a sendToQueue helper function which publishes a message and attributes, i.e. message attributes, to a SQS queue by the Queue URL.
The wrapper should provide a getter which returns the singleton instance of the SQSClient.
Acceptance criteria
GIVEN the app initializes an instance of the SQS client
WHEN no parameters are supplied to the initializer
THEN an instance of the client is created using the default configuration for the SQSClient
WHEN the SQSClientConfig is provided to the initializer
THEN the SQSClient instance is constructed using the supplied configuration
WHEN the SQSClient instances are constructed
THEN they are cached as singleton instances
GIVEN the sendToQueue function is invoked
WHEN the singleton instance does not exist
THEN a SQSClient instance is constructed with default configuration
AND the instance is cached as the singleton
AND the instance is used by the sendToQueue function
WHEN the singleton instance already exists
THEN the instance is used by the sendToQueue function
Additional context
n/a
Describe the story
Create a SQS client utility which serves as a wrapper around the AWS SDK
SQSClient. This should simplify the creation of the AWS SDK SQS client and it should store the created instance as a singleton for reuse across Lambda function invocations.The wrapper should provide a
sendToQueuehelper function which publishes amessageandattributes, i.e. message attributes, to a SQS queue by the Queue URL.The wrapper should provide a getter which returns the singleton instance of the
SQSClient.Acceptance criteria
GIVEN the app initializes an instance of the SQS client
WHEN no parameters are supplied to the initializer
THEN an instance of the client is created using the default configuration for the SQSClient
WHEN the
SQSClientConfigis provided to the initializerTHEN the
SQSClientinstance is constructed using the supplied configurationWHEN the
SQSClientinstances are constructedTHEN they are cached as singleton instances
GIVEN the
sendToQueuefunction is invokedWHEN the singleton instance does not exist
THEN a
SQSClientinstance is constructed with default configurationAND the instance is cached as the singleton
AND the instance is used by the
sendToQueuefunctionWHEN the singleton instance already exists
THEN the instance is used by the
sendToQueuefunctionAdditional context
n/a