bus

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2021 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Pub

func Pub(e *event.Event) error

Pub bus为全局对象

func SetPublisher

func SetPublisher(p Publisher)

SetPublisher 设置pub

func SetSubscriber

func SetSubscriber(s Subscriber)

SetSubscriber 设置sub

func Sub

func Sub(t event.Type, h EventHandler) error

Sub bus为全局对象

Types

type EventHandler

type EventHandler func(topic string, e *event.Event) error

EventHandler is used to process messages via a subscription of a topic.

type Manager

type Manager interface {
	Connect() error
	Disconnect() error
}

Manager 管理端

type PubManager

type PubManager interface {
	Manager
	Publisher
}

PubManager 带管理

type Publisher

type Publisher interface {
	// 发送事件
	Pub(topic string, e *event.Event) error
}

Publisher 发送事件

func P

func P() Publisher

P todo

type SubManager

type SubManager interface {
	Manager
	Subscriber
}

SubManager 带管理

type Subscriber

type Subscriber interface {
	Sub(topic string, h EventHandler) error
}

Subscriber 订阅事件

func S

func S() Subscriber

S todo

Directories

Path Synopsis
broker
kafka
Package kafka https://github.com/Shopify/sarama/blob/master/examples/sasl_scram_client/scram_client.go
Package kafka https://github.com/Shopify/sarama/blob/master/examples/sasl_scram_client/scram_client.go

Jump to

Keyboard shortcuts

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