queue

package
v0.0.0-...-cd796bd Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2022 License: GPL-3.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 Message

type Message struct {
	ID      string `json:"id"`
	Name    string `json:"name"`
	Payload string `json:"payload"`
}

Message represents messages stored on the queue

type Queue

type Queue interface {
	Add(messageName string, payload []byte) error
	AddMessage(message Message) error
	StartConsuming(size int, pollInterval time.Duration, callback func(Message) error)
}

Queue defines the interface for a message queue

type RedisQueue

type RedisQueue struct {
	Queue rmq.Queue
	// contains filtered or unexported fields
}

RedisQueue implements the Queue interface for a Redis based message queue

func NewRedisQueue

func NewRedisQueue(connectionString string, queueName string) (*RedisQueue, error)

NewRedisQueue creates a new RedisQueue

func (*RedisQueue) Add

func (r *RedisQueue) Add(messageName string, payload []byte) error

Add a new message with the given payload to the queue

func (*RedisQueue) AddMessage

func (r *RedisQueue) AddMessage(message Message) error

AddMessage to the queue, generating a unique ID for the message before dispatc

func (*RedisQueue) Consume

func (r *RedisQueue) Consume(delivery rmq.Delivery)

Consume is the internal callback for the message queue

func (*RedisQueue) StartConsuming

func (r *RedisQueue) StartConsuming(size int, pollInterval time.Duration, callback func(Message) error)

StartConsuming consumes messages from the queue

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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