Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { QueueURL string // processor configuration ProcessorWorkerPoolSize int32 // poller configuration PollerWorkerPoolSize int32 // MaxNumberOfMessages is the maximum number of messages to receive in a single poll request: 1-10 MaxNumberOfMessages int32 // WaitTimeSeconds is the duration (0 to 20 seconds) for which the call waits for a message to arrive WaitTimeSeconds int32 // VisibilityTimeout is the duration (0 to 12 hours) that the received messages are hidden from subsequent retrieve requests VisibilityTimeout int32 // MaxNumberOfRetries is the maximum number of retries for a message polling. -1 means infinite retries ErrorNumberThreshold int32 // GracefulShutdownTimeout is the timeout for graceful shutdown. GracefulShutdownTimeout int32 }
func NewDefaultConfig ¶
NewDefaultConfig creates a new Config with default values
type DummyAdapter ¶
func NewDummyAdapter ¶
func NewDummyAdapter[T sqstypes.Message]() *DummyAdapter[T]
type Handler ¶
Handler is a generic interface for message handlers. The type parameter T specifies the type of message the handler accepts.
type HandlerFunc ¶
type JSONMessageAdapter ¶
type JSONMessageAdapter[T any] struct{}
JSONMessageAdapter is a message adapter for json messages
func NewJSONMessageAdapter ¶
func NewJSONMessageAdapter[T any]() *JSONMessageAdapter[T]
type MessageAdapter ¶
type MessageAdapterFunc ¶
type Middleware ¶
type Middleware[T any] func(next HandlerFunc[T]) HandlerFunc[T]
func MiddlewareAdapter ¶
func MiddlewareAdapter[T any](mw Middleware[any]) Middleware[T]
MiddlewareAdapter adapts a middleware of any type to a middleware of a specific type T. It creates a new handler that operates on T and a new handler that matches the HandlerFunc[Message] type.
func NewIgnoreErrorsMiddleware ¶
func NewIgnoreErrorsMiddleware[T any](l *slog.Logger) Middleware[T]
NewIgnoreErrorsMiddleware creates a new middleware that ignores errors that occur during message processing. If the logger is provided, it will log the error.
func NewPanicRecoverMiddleware ¶
func NewPanicRecoverMiddleware[T any]() Middleware[T]
func NewTimeLimitMiddleware ¶
func NewTimeLimitMiddleware[T any](timeout time.Duration) Middleware[T]
type SQSConsumer ¶
type SQSConsumer[T any] struct { // contains filtered or unexported fields }
func NewSQSConsumer ¶
func NewSQSConsumer[T any]( cfg Config, sqsClient sqsConnector, messageAdapter MessageAdapter[T], middlewares []Middleware[T], logger *slog.Logger, ) *SQSConsumer[T]
func (*SQSConsumer[T]) Close ¶
func (c *SQSConsumer[T]) Close() error
func (*SQSConsumer[T]) IsRunning ¶
func (c *SQSConsumer[T]) IsRunning() bool
type WrongConfigError ¶
type WrongConfigError struct {
Err error
}
func (*WrongConfigError) Error ¶
func (e *WrongConfigError) Error() string
Click to show internal directories.
Click to hide internal directories.