bus

package
v0.3.4 Latest Latest
Warning

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

Go to latest
Published: Jul 3, 2020 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetPublisher

func SetPublisher(p Publisher)

SetPublisher 设置pub

func SetSubscriber

func SetSubscriber(s Subscriber)

SetSubscriber 设置sub

Types

type EventHandler added in v0.3.4

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

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

type Manager added in v0.3.4

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

Manager 管理端

type Publisher

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

Publisher 发送事件

func P

func P() Publisher

P bus为全局对象

type Subscriber

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

Subscriber 订阅事件

func S

func S() Subscriber

S bus为全局对象

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