inmemory

package
v0.6.9-cortex-dev Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2023 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 Queue

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

Queue simulates queue inmemory, this is for testing only not recommended to use this in production

func New

func New(logger log.Logger, capacity uint) *Queue

New creates a new queue instance

func (*Queue) Cleanup

func (q *Queue) Cleanup(ctx context.Context, filter queues.FilterCleanup) error

func (*Queue) Dequeue

func (q *Queue) Dequeue(ctx context.Context, receiverTypes []string, batchSize int, handlerFn func(context.Context, []notification.Message) error) error

Dequeue pop the queue based on specific filters (receiver types or batch size) and process the messages with handlerFn

func (*Queue) Enqueue

func (q *Queue) Enqueue(ctx context.Context, ms ...notification.Message) error

Enqueue pushes messages to the queue

func (*Queue) ErrorCallback

func (q *Queue) ErrorCallback(ctx context.Context, ms notification.Message) error

ErrorCallback is a callback that will be called once the message is failed to be handled by handlerFn

func (*Queue) Stop

func (q *Queue) Stop(ctx context.Context) error

Stop is a inmemmory queue function this will close the channel to simulate queue

func (*Queue) SuccessCallback

func (q *Queue) SuccessCallback(ctx context.Context, ms notification.Message) error

SuccessCallback is a callback that will be called once the message is succesfully handled by handlerFn

func (*Queue) Type

func (q *Queue) Type() string

Jump to

Keyboard shortcuts

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