worker

package
v0.0.0-...-f397471 Latest Latest
Warning

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

Go to latest
Published: Sep 6, 2017 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// what is the queue url we are connecting to, Defaults to empty
	QueueURL string = ""
	// The maximum number of messages to return. Amazon SQS never returns more messages
	// than this value (however, fewer messages might be returned). Valid values
	// are 1 to 10. Default is 10.
	MaxNumberOfMessage int64 = 10
	// 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 WaitTimeSeconds.
	WaitTimeSecond int64 = 20

	Log LoggerIFace = &logger{}
)

Exported Variables

Functions

func NewSQSClient

func NewSQSClient(queueName string, cfgs ...*aws.Config) (*sqs.SQS, string)

NewSQSClient returns a SQS Client and a Queue URL for you you to connect to

func Start

func Start(svc *sqs.SQS, h Handler)

func Stop

func Stop()

Stops polling to receive new messages, to enable clean shutdown.

Types

type Handler

type Handler interface {
	HandleMessage(msg *sqs.Message) error
}

Handler interface

type HandlerFunc

type HandlerFunc func(msg *sqs.Message) error

HandlerFunc is used to define the Handler that is run on for each message

func (HandlerFunc) HandleMessage

func (f HandlerFunc) HandleMessage(msg *sqs.Message) error

type InvalidEventError

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

func NewInvalidEventError

func NewInvalidEventError(event, msg string) InvalidEventError

func (InvalidEventError) Error

func (e InvalidEventError) Error() string

type LoggerIFace

type LoggerIFace interface {
	Debug(i ...interface{})
	Info(i ...interface{})
	Error(i ...interface{})
}

Jump to

Keyboard shortcuts

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