sqs

package
v0.0.0-...-3cd1d61 Latest Latest
Warning

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

Go to latest
Published: Jun 22, 2025 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type SQSConsumer

type SQSConsumer[I []byte, O []*SQSConsumerOutput] struct {
	// contains filtered or unexported fields
}

SQS Consumer is a Task that when called, get messages from a SQS queue and return them. It return an array of SQSConsumerOutput and append messages receipt handlers on metadata Exclude messages based on receipt handler is user responsability

func NewSQSConsumer

func NewSQSConsumer[I []byte, O []*SQSConsumerOutput](client sqsiface.SQSAPI, logger *slog.Logger, opts *SQSConsumerOpts) *SQSConsumer[I, O]

func (*SQSConsumer[I, O]) GetQueueURL

func (c *SQSConsumer[I, O]) GetQueueURL() *string

func (*SQSConsumer[I, O]) Run

func (c *SQSConsumer[I, O]) Run(_ context.Context, _ interface{}, meta map[string]interface{}, name string) (O, error)

Run when called consume messages from SQS and return TaskData with Data containing an array of *SQSConsumerOutput It appends receipt handlers to metadata to be excluded later by user

type SQSConsumerOpts

type SQSConsumerOpts struct {
	// QueueName which Consumer will use to get QueueURL
	QueueName string
	// VisibilityTimeout to be used
	VisibilityTimeout int64
	// MaxNumberOfMessages to Get when called. Max 10 on normal queues (SQS API max)
	MaxNumberOfMessages int64
}

type SQSConsumerOutput

type SQSConsumerOutput struct {
	// Content of the message
	Content *string
	// It receipt handler
	ReceiptHandle string
}

type SQSDeleter

type SQSDeleter[I string, O task.Nullable] struct {
	// contains filtered or unexported fields
}

SQSDeleter will delete a message on SQS based on a given receiptHandle

func NewSQSDeleter

func NewSQSDeleter[I string, O task.Nullable](client sqsiface.SQSAPI, logger *slog.Logger, opts *SQSDeleterOpts) *SQSDeleter[I, O]

func (*SQSDeleter[I, O]) GetQueueURL

func (s *SQSDeleter[I, O]) GetQueueURL() *string

func (*SQSDeleter[I, O]) Run

func (s *SQSDeleter[I, O]) Run(_ context.Context, input I, meta map[string]interface{}, _ string) (O, error)

Run() delete a message on SQS based on the return of adaptFn. It only returns errors

type SQSDeleterOpts

type SQSDeleterOpts struct {
	// SQS queue name which Deleter will use to get queue url
	QueueName string
}

type SQSProducer

type SQSProducer[I SQSProducerInput, O task.Nullable] struct {
	// contains filtered or unexported fields
}

Simple generic task to produce messages to SQS

func NewSQSProducer

func NewSQSProducer[I SQSProducerInput, O task.Nullable](client sqsiface.SQSAPI, logger *slog.Logger, opts *SQSProducerOpts) *SQSProducer[I, O]

func (*SQSProducer[I, O]) GetQueueURL

func (p *SQSProducer[I, O]) GetQueueURL() *string

func (*SQSProducer[I, O]) Run

func (c *SQSProducer[I, O]) Run(_ context.Context, i I, meta map[string]interface{}, name string) (O, error)

Run will produce message returned by sqsProducerAdaptFn to the targete SQS queue. It always returns nil, being capable of only return error if any happen

type SQSProducerInput

type SQSProducerInput struct {
	Body   string
	MsgAtt map[string]*sqs.MessageAttributeValue
}

type SQSProducerOpts

type SQSProducerOpts struct {
	// Delay which message will be delivered (if not given, will use default from queue)
	DelaySeconds *int64
	// QueueName
	QueueName string
}

SQS Producer options

Jump to

Keyboard shortcuts

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