sns

package
v0.1.6 Latest Latest
Warning

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

Go to latest
Published: Jun 29, 2023 License: BSD-3-Clause-Clear Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewTopic

func NewTopic(topicARN string, opts ...Option) (msg.Topic, error)

NewTopic returns a sns.Topic with fully configured SNSAPI.

Note: SQS has limited support for unicode characters. - See http://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/limits-messages.html Because we use SNS and SQS together, we recommend that SNS messages are base64-encoded as a best practice. You may use NewUnencodedTopic if you wish to ignore the encoding step.

func NewUnencodedTopic

func NewUnencodedTopic(topicARN string, opts ...Option) (msg.Topic, error)

NewUnencodedTopic creates an concrete SNS msg.Topic

Messages published by the `Topic` returned will not have the body base64-encoded.

Types

type MessageWriter

type MessageWriter struct {
	msg.MessageWriter
	// contains filtered or unexported fields
}

MessageWriter writes data to an output SNS topic as configured via its topicARN.

func (*MessageWriter) Attributes

func (w *MessageWriter) Attributes() *msg.Attributes

Attributes returns the msg.Attributes associated with the MessageWriter.

func (*MessageWriter) Close

func (w *MessageWriter) Close() error

Close converts the MessageWriter's Body and Attributes to sns.PublishInput in order to publish itself to the MessageWriter's snsClient.

On the first call to Close, the MessageWriter is set to "isClosed" therefore blocking subsequent Close and Write calls.

func (*MessageWriter) Write

func (w *MessageWriter) Write(p []byte) (int, error)

Write writes data to the MessageWriter's internal buffer for aggregation before a .Close()

After a MessageWriter's .Close() method has been called, it is no longer available for .Write() calls.

type Option

type Option func(*Topic) error

Option is the signature that modifies a `Topic` to set some configuration

func WithCustomRetryer

func WithCustomRetryer(r request.Retryer) Option

WithCustomRetryer sets a custom `Retryer` to use on the SQS client.

func WithRetries

func WithRetries(delay time.Duration, max int) Option

WithRetries makes the `Server` retry on credential errors until `max` attempts with `delay` seconds between requests. This is needed in scenarios where credentials are automatically generated and the program starts before AWS finishes propagating them

type Topic

type Topic struct {
	Svc      snsiface.SNSAPI
	TopicARN string
	// contains filtered or unexported fields
}

Topic configures and manages SNSAPI for sns.MessageWriter.

func (*Topic) NewWriter

func (t *Topic) NewWriter(ctx context.Context) msg.MessageWriter

NewWriter returns a sns.MessageWriter instance for writing to the configured SNS topic.

Jump to

Keyboard shortcuts

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