broker

package
v0.0.0-...-b08fcc5 Latest Latest
Warning

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

Go to latest
Published: Jun 22, 2023 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Publish

func Publish(ctx context.Context, in *Message) error

func Subscribe

func Subscribe(ctx context.Context, topic string, handler mBroker.Handler, opts ...mBroker.SubscribeOption)

Types

type Message

type Message struct {
	UID       int64                  `json:"uid"`       // 用户ID
	Topic     string                 `json:"topic"`     // 主题名称
	Options   map[string]interface{} `json:"options"`   // 额外参数
	Payload   interface{}            `json:"payload"`   // 自定义数据
	Timestamp int64                  `json:"timestamp"` // 秒时间戳
}

func NewMessage

func NewMessage(topic string, payload interface{}) *Message

func (*Message) SetOptions

func (m *Message) SetOptions(options map[string]interface{}) *Message

func (*Message) SetPayload

func (m *Message) SetPayload(payload interface{}) *Message

func (*Message) SetTimestamp

func (m *Message) SetTimestamp(timestamp int64) *Message

func (*Message) SetTopic

func (m *Message) SetTopic(topic string) *Message

func (*Message) SetUID

func (m *Message) SetUID(uid int64) *Message

Jump to

Keyboard shortcuts

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