v1.3.6 Latest Latest

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

Go to latest
Published: Aug 25, 2020 License: Apache-2.0 Imports: 17 Imported by: 69




This section is empty.


This section is empty.


func NewPublisher

func NewPublisher(cfg SNSConfig) (pubsub.Publisher, error)

NewPublisher will initiate the SNS client. If no credentials are passed in with the config, the publisher is instantiated with the AWS_ACCESS_KEY and the AWS_SECRET_KEY environment variables.

func NewSubscriber

func NewSubscriber(cfg SQSConfig) (pubsub.Subscriber, error)

NewSubscriber will initiate a new Decrypter for the subscriber if a key file is provided. It will also fetch the SQS Queue Url and set up the SQS client.

func WithMessageAttributes added in v1.3.3

func WithMessageAttributes(ctx context.Context, msgAttrs map[string]*sns.MessageAttributeValue) context.Context

WithMessageAttributes used to add SNS Message Attributes to the context for further usage in publishing messages to sns with provided attributes


type SNSConfig

type SNSConfig struct {

	Topic string `envconfig:"AWS_SNS_TOPIC"`

SNSConfig holds the info required to work with Amazon SNS.

func LoadSNSConfigFromEnv

func LoadSNSConfigFromEnv() SNSConfig

LoadSNSConfigFromEnv will attempt to load the SNSConfig struct from environment variables. If not populated, nil is returned.

type SQSConfig

type SQSConfig struct {
	QueueName           string `envconfig:"AWS_SQS_NAME"`
	QueueOwnerAccountID string `envconfig:"AWS_SQS_OWNER_ACCOUNT_ID"`
	// QueueURL can be used instead of QueueName and QueueOwnerAccountID.
	// If provided, the client will skip the "GetQueueUrl" call to AWS.
	QueueURL string `envconfig:"AWS_SQS_QUEUE_URL"`
	// MaxMessages will override the DefaultSQSMaxMessages.
	MaxMessages *int64 `envconfig:"AWS_SQS_MAX_MESSAGES"`
	// TimeoutSeconds will override the DefaultSQSTimeoutSeconds.
	TimeoutSeconds *int64 `envconfig:"AWS_SQS_TIMEOUT_SECONDS"`
	// SleepInterval will override the DefaultSQSSleepInterval.
	SleepInterval *time.Duration `envconfig:"AWS_SQS_SLEEP_INTERVAL"`
	// DeleteBufferSize will override the DefaultSQSDeleteBufferSize.
	DeleteBufferSize *int `envconfig:"AWS_SQS_DELETE_BUFFER_SIZE"`
	// ConsumeBase64 is a flag to signal the subscriber to base64 decode the payload
	// before returning it. If it is not set in the config, the flag will default
	// to 'true'.
	ConsumeBase64 *bool `envconfig:"AWS_SQS_CONSUME_BASE64"`

SQSConfig holds the info required to work with Amazon SQS

func LoadSQSConfigFromEnv

func LoadSQSConfigFromEnv() SQSConfig

LoadSQSConfigFromEnv will attempt to load the SQSConfig struct from environment variables. If not populated, nil is returned.

Jump to

Keyboard shortcuts

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