multicast

package
v0.0.0-...-76745ad Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2025 License: BSD-3-Clause Imports: 12 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithChannelName

func WithChannelName(name string) func(*Options)

WithChannelName 设置通道名称

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, options ...func(*Options)) *Bus

NewNatsBus 使用nats构造总线

func NewRedisBus

func NewRedisBus(client *redis.Client, options ...func(*Options)) *Bus

NewRedisBus 构造函数

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 Options

type Options struct {
	// ChannelName 通道名称,默认为nodehub:multicast
	//
	// 不同的总线实现内有不同的含义,在nats里面是topic,redis里面是channel
	ChannelName string
}

Options 配置

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