longsub

package module
v1.5.2 Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2024 License: MIT Imports: 0 Imported by: 0

README

main Go Reference

NOTE: GCP PubSub now supports async subscription. I recommend using that instead of this.

Overview

longsub is a small wrapper package for lengthy subscriptions for both SQS and PubSub. It will setup the subscription and attempts to extend the processing window at message level until the processing is done, or failed, or requeued. Useful if you want to keep the queue timeout relatively short (for quick message redelivery) but have the option for subscribers to have longer time to process each of the messages.

Check out the examples provided for reference on how to use the package.

Authentication

For AWS, the following environment variables will be used.

# Required
AWS_REGION
AWS_ACCESS_KEY_ID
AWS_SECRET_ACCESS_KEY

# Optional. If non-empty, package will attempt to assume this role
# using the key/secret above.
ROLE_ARN

For GCP, the path of the service account JSON file is required.

GOOGLE_APPLICATION_CREDENTIALS=/etc/longsub/svcacct.json

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type RequeueError

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

RequeueError is an error wrapper that implements the 'Requeuer' interface so we can check if a pubsub message processing error will be resubmitted back to queue.

func NewRequeueError

func NewRequeueError(err error, requeue ...bool) RequeueError

NewRequeueError is our convenience function for creating a RequeueError object.

func (RequeueError) ShouldRequeue

func (re RequeueError) ShouldRequeue() bool

type Requeuer

type Requeuer interface {
	ShouldRequeue() bool
}

Directories

Path Synopsis
examples
aws
gcp

Jump to

Keyboard shortcuts

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