Skip to content

SNS client wrapper #12

@mwarman

Description

@mwarman

Describe the story

Create a SNS client utility which serves as a wrapper around the AWS SDK SNSClient. This should simplify the creation of the AWS SDK SNS client and it should store the created instance as a singleton for reuse across Lambda function invocations.

The wrapper should provide a publishToTopic helper function which publishes a message and attributes, i.e. message attributes, to a SNS topic by the Topic ARN.

The wrapper should provide a getter which returns the singleton instance of the SNSClient.

Acceptance criteria

GIVEN the app initializes an instance of the SNS client
WHEN no parameters are supplied to the initializer
THEN an instance of the client is created using the default configuration for the SNSClient

WHEN the SNSClientConfig is provided to the initializer
THEN the SNSClient instance is constructed using the supplied configuration

WHEN the SNSClient instances are constructed
THEN they are cached as singleton instances

GIVEN the publishToTopic function is invoked
WHEN the singleton instance does not exist
THEN a SNSClient instance is constructed with default configuration
AND the instance is cached as the singleton
AND the instance is used by the publishToTopic function

WHEN the singleton instance already exists
THEN the instance is used by the publishToTopic function

Additional context

Add any other context about the story here.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions