multicast

package
v0.0.0-...-c1a148e Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2024 License: BSD-3-Clause Imports: 8 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Channel = "nodehub:multicast"

Channel 通道名称

Functions

This section is empty.

Types

type Bus

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

Bus push message总线

func NewBus

func NewBus(queue Queue) *Bus

NewBus 构造函数

func NewNatsBus

func NewNatsBus(conn *nats.Conn) *Bus

NewNatsBus 使用nats构造总线

func NewRedisBus

func NewRedisBus(client *redis.Client) *Bus

NewRedisBus 构造函数

client 可以使用 *redis.Client 或者 *redis.ClusterClient

当使用ClusterClient时,会采用sharded channel

func (*Bus) Close

func (bus *Bus) Close()

Close 关闭消息队列

func (*Bus) Publish

func (bus *Bus) Publish(ctx context.Context, message *nh.Multicast) error

Publish 把消息发布到消息队列

func (*Bus) Subscribe

func (bus *Bus) Subscribe(ctx context.Context, handler func(*nh.Multicast)) error

Subscribe 从消息队列订阅消息

type Publisher

type Publisher interface {
	Publish(ctx context.Context, message *nh.Multicast) error
}

Publisher 把消息发布到消息队列

type Queue

type Queue = mq.Queue

Queue 消息队列

type Subscriber

type Subscriber interface {
	Subscribe(ctx context.Context, handler func(*nh.Multicast)) error
}

Subscriber 从消息队列订阅消息

Jump to

Keyboard shortcuts

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