aws

package
v0.0.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 25, 2024 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BindAttributes

func BindAttributes(attributes map[string]interface{}) (map[string]*sns.MessageAttributeValue, error)

Types

type AWSPubSubAdapter

type AWSPubSubAdapter struct {
	// contains filtered or unexported fields
}

func NewAWSPubSubAdapter

func NewAWSPubSubAdapter(region, accessKeyId, secretAccessKey, snsEndpoint, redisAddress, redisPassword string, redisDB, redisPoolSize, redisMinIdleConn int) (*AWSPubSubAdapter, error)

func (*AWSPubSubAdapter) FetchValueFromRedis

func (ps *AWSPubSubAdapter) FetchValueFromRedis(redisKey string) (string, error)

Expects the redis key (uuid), fetches the value from redis and returns it as string always. Since all values are stored as string in redis for now.

func (*AWSPubSubAdapter) PollMessages

func (ps *AWSPubSubAdapter) PollMessages(queueURL string, handler func(message *sqs.Message) error) error

Polls messages from SQS with queueURL, using long polling for 20 seconds, visibility timeout of 5 seconds and maximum of 10 messages read at once. Handler func will be executed for each message individually, if error returned from the handler func is nil, message is deleted from queue, else returns error

func (*AWSPubSubAdapter) Publish

func (ps *AWSPubSubAdapter) Publish(topicARN string, messageGroupId, messageDeduplicationId string, message interface{}, messageAttributes map[string]interface{}) error

Publishes the message with the messageAttributes to the topicARN provided. source, contains and eventType are necessary keys in messageAttributes. Returns error if fails to publish message

When the SNS Topic is FIFO type, messageGroupId and messageDeduplicationId are required. - messageGroupId : SNS orders the messages in a message group into a sequence. - messageDeduplicationId : SNS uses this to determine whether to create a new message or to use an existing one.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL