sqs

package
v0.1.3 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	BackoffFactor = 1.5
)
View Source
const (
	MaxWaitTime = 127
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Error

type Error struct {
	Type ErrorType
	Msg  types.Message
	Err  error
}

func (Error) Error

func (t Error) Error() string

type ErrorType

type ErrorType int
const (
	UnmarshalError ErrorType = iota
	MarshalError
	ReceiveError
	SendError
)

type JSONSerializer

type JSONSerializer[T any] struct {
}

func (JSONSerializer[T]) Marshal

func (t JSONSerializer[T]) Marshal(in <-chan T) (<-chan string, <-chan error)

func (JSONSerializer[T]) Unmarshal

func (t JSONSerializer[T]) Unmarshal(in <-chan types.Message) (<-chan Message[T], <-chan error)

type Message

type Message[T any] struct {
	Msg types.Message
	Obj T
}

type SQSClient

type SQSClient[T any] struct {
	BufferSize   int
	BatchSize    int
	BatchTimeout time.Duration
	// contains filtered or unexported fields
}

func New

func New[T any](done <-chan struct{}, cfg aws.Config, serializer Serializer[T], queueURL string) (*SQSClient[T], error)

func NewJSONQueue

func NewJSONQueue[T any](done <-chan struct{}, cfg aws.Config, queueURL string) (*SQSClient[T], error)

func (*SQSClient[T]) DeleteMessage

func (t *SQSClient[T]) DeleteMessage(message types.Message) error

func (*SQSClient[T]) Send

func (t *SQSClient[T]) Send(workerCount int, inCh <-chan T) <-chan error

func (*SQSClient[T]) SendBatch

func (t *SQSClient[T]) SendBatch(workerCount int, inCh <-chan T) <-chan error

func (*SQSClient[T]) StartPolling

func (t *SQSClient[T]) StartPolling(workerCount int) (<-chan Message[T], <-chan error)

type Serializer

type Serializer[T any] interface {
	Unmarshal(in <-chan types.Message) (<-chan Message[T], <-chan error)
	Marshal(in <-chan T) (<-chan string, <-chan error)
}

Jump to

Keyboard shortcuts

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