message_queue

package
v0.0.0-...-e71a76f Latest Latest
Warning

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

Go to latest
Published: Jan 30, 2025 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrQueueNotFound is returned when a queue is not found.
	ErrQueueNotFound = fmt.Errorf("queue not found")
)

Functions

This section is empty.

Types

type Client

type Client struct {
	RedisClient *redis.Client
}

Client is used to manage key-value pairs in Redis.

func New

func New() *Client

New returns a new key-value client.

func (*Client) Consume

func (client *Client) Consume(ctx context.Context, queueName string, handler func(data []byte) error) error

Consume starts consuming messages from the given queue. It is non-blocking and will run in a separate goroutine.

func (*Client) GetListeners

func (client *Client) GetListeners(queueName string) (int, error)

GetListeners returns the number of listeners for the given queue.

func (*Client) Publish

func (client *Client) Publish(queueName string, jsonData interface{}) error

Publish sends a message to the given queue.

Jump to

Keyboard shortcuts

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