sqs

package
v0.0.16 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	DefaultSleepInterval = 2 * time.Second
)

Variables

View Source
var Service = dependency.Service{
	Name: "gizmo-sqs",
	ConfigFunc: func(set dependency.FlagSet) {
		set.String("aws-sqs-queue-name", "", "The name of the SQS Queue you want to read from")
		set.String("aws-sqs-queue-owner-account-id", "", "The account ID of the owner of the SQS Queue")
		set.String("aws-sqs-queue-url", "", "The URL of the SQS Queue")
		set.Int64("aws-sqs-max-messages", 10, "The number of bulk messages the SQSSubscriber will attempt to fetch on each receive.")
		set.Int64("aws-sqs-timeout-seconds", 2, "The number of seconds the SQS client will wait before timing out.")
		set.Duration("aws-sqs-sleep-interval", DefaultSleepInterval, "The time the SQSSubscriber will wait if it sees no messages on the queue.")
		set.Int("aws-sqs-delete-buffer-size", 0, "The limit of messages allowed in the delete buffer before executing a 'delete batch' request.")
		set.Bool("aws-sqs-consume-base64", false, "A flag to signal the subscriber to base64 decode the payload before returning it.")
	},
	Dependencies: fx.Provide(
		NewSQSConfig,
	),
	Constructor: aws2.NewSubscriber,
	InvokeFunc:  Invoke,
}

Service is a dependency that provides an SQS Subscriber for a service

Functions

func Invoke

func Invoke(params StopParams)

Invoke is the function that is registered with fx in order to gracefully shut down the server.

func NewSQSConfig

func NewSQSConfig(awscfg aws.Config, config dependency.ConfigGetter) aws2.SQSConfig

NewSQSConfig gives you a new instance of aws.SQSConfig for a given dependency.ConfigGetter

Types

type StopParams

type StopParams struct {
	fx.In

	Lifecycle fx.Lifecycle
	Logger    *zap.Logger
	Queue     pubsub.Subscriber
}

StopParams are the parameters required in order to register an invoke function, that is used to stop the queue reader.

Jump to

Keyboard shortcuts

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