awssqs

package
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: 18 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Helper

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

func NewHelper

func NewHelper(region, key, secret, rolearn string) *Helper

func (*Helper) GetAcctId

func (u *Helper) GetAcctId() (*string, error)

func (*Helper) GetSqs

func (u *Helper) GetSqs(name string) (*string, map[string]*string, error)

GetSqs creates an SQS queue and returning the queue url and attributes.

func (*Helper) GetSqsAllowAllPolicy

func (u *Helper) GetSqsAllowAllPolicy(queue string) string

GetSqsAllowAllPolicy returns a policy that can be used when creating an SQS queue that allow all SQS actions for everybody.

func (*Helper) GetTopic

func (u *Helper) GetTopic(name string) (*string, error)

GetTopic returns the ARN of a newly created topic or an existing one. CreateTopic API returns the ARN of an existing topic.

func (*Helper) SetupSnsSqsSubscription

func (u *Helper) SetupSnsSqsSubscription(topic, sub string) (*string, error)

SetupSnsSqsSubscription creates a subscription of sub to topic. It returns topic's ARN along with error.

func (*Helper) SubscribeToTopic

func (u *Helper) SubscribeToTopic(in *SubscribeToTopicInput) (*sns.SubscribeOutput, error)

SubscribeToTopic creates the queue, or use an existing queue, and subscribe to the provided SNS topic.

type LengthySubscriber

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

func NewLengthySubscriber

func NewLengthySubscriber(ctx interface{}, queue string, callback SqsMessageCallback, o ...Option) *LengthySubscriber

NewLengthySubscriber creates a lengthy subscriber object for SQS.

func (*LengthySubscriber) Start

func (l *LengthySubscriber) Start(quit context.Context, done ...chan error) error

Start starts the main goroutine handler. Terminates via 'ctx'. If 'done' is provided, will send a message there to signal caller that it's done with processing.

type Option

type Option interface {
	Apply(*LengthySubscriber)
}

func WithAccessKeyId

func WithAccessKeyId(v string) Option

WithAccessKeyId sets the access key id option.

func WithFatalOnQueueError

func WithFatalOnQueueError(v bool) Option

WithFatalOnQueueError sets the function to crash when queue error.

func WithLogger

func WithLogger(v *log.Logger) Option

WithLogger sets the logger option. Can be silenced by setting v to:

log.New(ioutil.Discard, "", 0)

func WithNoExtend

func WithNoExtend(v bool) Option

WithNoExtend sets the flag to not extend the visibility timeout.

func WithRegion

func WithRegion(v string) Option

WithRegion sets the region option.

func WithRoleArn

func WithRoleArn(v string) Option

WithRoleArn sets the role arn option to assume to.

func WithSecretAccessKey

func WithSecretAccessKey(v string) Option

WithSecretAccessKey sets the secret access key option.

func WithTimeout

func WithTimeout(v int64) Option

WithTimeout sets the timeout option.

type SqsMessageCallback

type SqsMessageCallback func(ctx interface{}, data []byte) error

type SubscribeToTopicInput

type SubscribeToTopicInput struct {
	QueueName  string
	TopicArn   string
	Attributes map[string]*string
}

Jump to

Keyboard shortcuts

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