aws

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2020 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Logger

type Logger interface {
	Printf(string, ...interface{})
}

Logger interface allows to use other loggers than standard log.Logger

type SQSMessage added in v0.0.2

type SQSMessage struct {
	RawMessage *sqs.Message
	// contains filtered or unexported fields
}

SQSMessage is the SQS implementation of `SubscriberMessage`.

func (*SQSMessage) Done added in v0.0.2

func (m *SQSMessage) Done() error

func (*SQSMessage) Message added in v0.0.2

func (m *SQSMessage) Message() []byte

type Subscriber

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

Subscriber is an SQS client that allows a user to consume messages via the Subscriber interface. Once Stop has been called on subscriber, it may not be reused; future calls to methods such as Consume or Stop will return an error.

func NewSubscriber

func NewSubscriber(sess *session.Session, cfg SubscriberConfig) *Subscriber

NewSubscriber creates a new sqs subscriber

func (*Subscriber) Consume

func (s *Subscriber) Consume() (<-chan transport.SubscriberMessage, <-chan error, error)

Consume starts consuming messages from the SQS queue. Returns a channel of SubscriberMessage to consume them and a channel of errors

func (*Subscriber) Stop

func (s *Subscriber) Stop() error

Stop stop gracefully the Subscriber

type SubscriberConfig

type SubscriberConfig struct {

	// SQS service endpoint. Normally overridden for testing only
	SqsEndpoint string

	// SQS queue from which the subscriber is going to consume from
	SqsQueueUrl string

	// number of messages the subscriber will attempt to fetch on each receive.
	MaxMessagesPerBatch int64

	// the duration (in seconds) for which the call waits for a message to arrive
	// in the queue before returning. If a message is available, the call returns
	// sooner than TimeSeconds. If no messages are available and the wait time
	// expires, the call returns successfully with an empty list of messages.
	TimeoutSeconds int64

	// The duration (in seconds) that the received messages are hidden from subsequent
	// retrieve requests after being retrieved by a ReceiveMessage request.
	// VisibilityTimeout should be < time needed to process a message
	VisibilityTimeout int64

	// number of consumers per subscriber
	NumConsumers int

	// subscriber logger
	Logger Logger
}

SubscriberConfig holds the info required to work with Amazon SQS and Quid integrations

Jump to

Keyboard shortcuts

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