listener

package
v0.0.0-...-b8ff64e Latest Latest
Warning

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

Go to latest
Published: Jan 30, 2018 License: MIT Imports: 7 Imported by: 2

Documentation

Overview

Package listener provides an SQS listener which calls a function on each message. After the handler is complete, listener deletes the message.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DedupSQSFilter

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

DedupSQSFilter filters messages if they are a recent duplicate

func NewDedupSQSFilter

func NewDedupSQSFilter(maxEntries int, lifetime time.Duration) *DedupSQSFilter

func (*DedupSQSFilter) Failed

func (f *DedupSQSFilter) Failed(msg *sqs.Message)

Failed will cleanup state of DedupSQSFilter when a message fails processing in this case it should be purged from the cache

func (*DedupSQSFilter) Filter

func (f *DedupSQSFilter) Filter(msg *sqs.Message) bool

Filter will return false to filter out messages if they are a recent duplicate

type SQSFilter

type SQSFilter interface {
	Filter(*sqs.Message) bool
	Failed(*sqs.Message)
}

SQSFilter will perform a predicate on messages

type SQSHandler

type SQSHandler interface {
	Handle(*sqs.Message) error
}

type SQSListener

type SQSListener struct {
	Handler SQSHandler
	// contains filtered or unexported fields
}

func BuildSQSListener

func BuildSQSListener(handler SQSHandler, pollInterval time.Duration, client sqsiface.SQSAPI, filter SQSFilter) *SQSListener

func (*SQSListener) Close

func (l *SQSListener) Close()

func (*SQSListener) Listen

func (l *SQSListener) Listen(qName string)

Jump to

Keyboard shortcuts

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