sqs

package
v2.0.2 Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

package sqs provides an aws sqs backed implementation of a queue data structure.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client interface {
	SendMessage(ctx context.Context,
		params *sqs.SendMessageInput, optFns ...func(*sqs.Options)) (*sqs.SendMessageOutput, error)
	ReceiveMessage(ctx context.Context,
		params *sqs.ReceiveMessageInput, optFns ...func(*sqs.Options)) (*sqs.ReceiveMessageOutput, error)
	DeleteMessage(ctx context.Context,
		params *sqs.DeleteMessageInput, optFns ...func(*sqs.Options)) (*sqs.DeleteMessageOutput, error)
	GetQueueAttributes(ctx context.Context, params *sqs.GetQueueAttributesInput,
		optFns ...func(*sqs.Options)) (*sqs.GetQueueAttributesOutput, error)
}

SQSClient is an interface that defines the necessary methods for interacting with the SQS service.

type Config

type Config struct {
	Region      string
	AccessKeyID string
	SecretKey   string
	QueueURL    string
}

Refer to aws.Config for more details.

type Queue

type Queue[T types.Marshallable] struct {
	// contains filtered or unexported fields
}

Queue is a wrapper struct around the SQS API.

func NewQueueFromAWSConfig

func NewQueueFromAWSConfig[T types.Marshallable](
	cfg aws.Config, queueURL string,
) (*Queue[T], error)

NewQueueFromAWSConfig creates a new SQS object with the specified AWS config & queue URL.

func NewQueueFromConfig

func NewQueueFromConfig[T types.Marshallable](cfg Config) (*Queue[T], error)

NewQueueFromConfig creates a new SQS object with the specified config & queue URL.

func (*Queue[T]) Delete

func (q *Queue[T]) Delete(messageID string) error

func (*Queue[T]) Len

func (q *Queue[T]) Len() int

func (*Queue[T]) Push

func (q *Queue[T]) Push(item T) (string, error)

Push adds an item to the SQS queue.

func (*Queue[T]) Receive

func (q *Queue[T]) Receive() (string, T, bool)

Pop retrieves an item from the SQS queue.

func (*Queue[T]) ReceiveMany

func (q *Queue[T]) ReceiveMany(num int32) ([]string, []T, error)

Jump to

Keyboard shortcuts

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