pubsub

package
v0.0.0-...-989dab9 Latest Latest
Warning

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

Go to latest
Published: Dec 31, 2024 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PubSub

type PubSub interface {
	Publisher
	Subscriber
	Close() error
}

PubSub is an interface that combines the Publisher and Subscriber interface.

func NewInternalChannelPubSub

func NewInternalChannelPubSub() PubSub

NewInternalChannelPubSub creates a new PubSub instance using in-memory channels.

func NewRedisPubSub

func NewRedisPubSub(redisAddr string) (PubSub, error)

NewRedisPubSub creates a new PubSub instance using Redis Streams.

type Publisher

type Publisher interface {
	Publish(ctx context.Context, topic string, msg []byte) error
}

Publisher is an interface that defines the method to publish messages to a topic.

type Subscriber

type Subscriber interface {
	Subscribe(ctx context.Context, topic string) (<-chan []byte, error)
}

Subscriber is an interface that defines the method to subscribe to a topic and consume messages.

Jump to

Keyboard shortcuts

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