redis

package module
v0.0.23 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MessageQueue

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

MessageQueue implements the MessageQueue interface using Redis.

func (*MessageQueue) Publish

func (q *MessageQueue) Publish(ctx context.Context, payload string) (string, error)

Publish a message to the queue.

func (*MessageQueue) Size

func (q *MessageQueue) Size() int64

Size returns the number of messages in the queue.

func (*MessageQueue) Subscribe

func (q *MessageQueue) Subscribe(ctx context.Context, handler func(queue.DeliverMessage)) error

Subscribe to the queue and process the messages.

type Provider

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

Provider implements the MessageQueueProvider using Redis.

func NewProvider

func NewProvider(addr string, password string, db int) (*Provider, error)

NewProvider creates a new Provider.

func (*Provider) Close

func (p *Provider) Close() error

Close closes all MessageQueue connections.

func (*Provider) MessageQueue

func (p *Provider) MessageQueue(subject string) (queue.MessageQueue, error)

MessageQueue obtains the corresponding MessageQueue based on subject.

func (*Provider) PublishToTopic

func (p *Provider) PublishToTopic(ctx context.Context, topic string, payload string) error

PublishToTopic publishes a message to the specified topic.

func (*Provider) QueueSubscribe

func (p *Provider) QueueSubscribe(ctx context.Context, subject string, handler func(queue.DeliverMessage)) (queue.Subscription, error)

QueueSubscribe creates a queue subscription.

func (*Provider) RequestReply

func (p *Provider) RequestReply(ctx context.Context, topic string, payload string) (*queue.Message, error)

RequestReply sends a request and waits for a response.

func (*Provider) SubscribeToTopic

func (p *Provider) SubscribeToTopic(ctx context.Context, topic string, handler func(queue.DeliverMessage)) (queue.Subscription, error)

SubscribeToTopic subscribes to messages for a specified topic.

Jump to

Keyboard shortcuts

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