sqsrelay

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Feb 8, 2021 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type QueueProcessor

type QueueProcessor struct {
	SQS                  SQSMessageReader
	QueueURL             string
	Handler              *deferred.Handler
	QueueWaitTimeSeconds int64
}

QueueProcessor reads and handles sqs messages produced by RelayHandler

func (*QueueProcessor) Process

func (q *QueueProcessor) Process(ctx context.Context) error

Process reads and handles SQS queue messages until an error occurs

type RelayHandler

type RelayHandler struct {
	SQS      SQSMessageSender
	QueueURL string
}

RelayHandler publishes the request to a SQS queue

func (*RelayHandler) Relay

func (r *RelayHandler) Relay(ctx context.Context, req *alexa.Request) error

Relay handles the alexa request by marshalling to json and sending it as a SQS message

type SQSMessageReader

type SQSMessageReader interface {
	ReceiveMessageWithContext(aws.Context, *sqs.ReceiveMessageInput, ...request.Option) (*sqs.ReceiveMessageOutput, error)
	DeleteMessageWithContext(aws.Context, *sqs.DeleteMessageInput, ...request.Option) (*sqs.DeleteMessageOutput, error)
}

SQSMessageReader is the subset of sqsiface.SQSAPI used by QueueProcessor

type SQSMessageSender

type SQSMessageSender interface {
	SendMessageWithContext(aws.Context, *sqs.SendMessageInput, ...request.Option) (*sqs.SendMessageOutput, error)
}

SQSMessageSender is the subset of sqsiface.SQSAPI used by RelayHandler

Jump to

Keyboard shortcuts

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