pubsub

package
v0.0.0-...-e419c83 Latest Latest
Warning

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

Go to latest
Published: May 27, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package pubsub provides a publish/subscribe interface for sending messages.

Package pubsub provides a Redis client for publishing and subscribing messages.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type RabbitMQPubSub

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

RabbitMQPubSub is a Redis client for publishing and subscribing messages.

func NewRabbitMQPubSub

func NewRabbitMQPubSub(conn *amqp.Connection) *RabbitMQPubSub

NewRabbitMQPubSub creates a new RabbitMQPubSub client.

func (*RabbitMQPubSub) Publish

func (ps *RabbitMQPubSub) Publish(ctx context.Context, topic string, b []byte) error

Publish publishes a message to a topic.

func (*RabbitMQPubSub) Subscribe

func (ps *RabbitMQPubSub) Subscribe(ctx context.Context, topic string, eventStream chan []byte)

Subscribe listens to a topic for incoming messages then adds them to the eventStream channel.

type RedisPubSub

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

RedisPubSub is a Redis client for publishing and subscribing messages.

func NewRedisPubSub

func NewRedisPubSub(conn *redis.Client) *RedisPubSub

NewRedisPubSub creates a new RedisPubSub client.

func (*RedisPubSub) Publish

func (ps *RedisPubSub) Publish(ctx context.Context, topic string, b []byte) error

Publish publishes a message to a topic.

func (*RedisPubSub) Subscribe

func (ps *RedisPubSub) Subscribe(ctx context.Context, topic string, eventStream chan []byte)

Subscribe listens to a topic for incoming messages then adds them to the eventStream channel.

Jump to

Keyboard shortcuts

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