eventbus

package module
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2022 License: Apache-2.0 Imports: 2 Imported by: 0

README

go-eventbus

Lightweight, highly available and versatile eventbus.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EventBus

type EventBus interface {
	// Subscribe to a topic
	Subscribe(ctx context.Context, topic string, handle SubscribeHandler) (err error)
	// Unsubscribe to a topic
	Unsubscribe(ctx context.Context, topic string, handle SubscribeHandler) (err error)
	// SubscribeOnce subscribes to a topic once. Handler will be removed after executing
	SubscribeOnce(ctx context.Context, topic string, handle SubscribeHandler) (err error)

	// Publish post a message to the topic
	Publish(ctx context.Context, topic string, msg *Message) (err error)

	// HandleCount get the number of Handle subscriptions for a topic
	HandleCount(topic string) int
}

EventBus event bus

type Message

type Message struct {
	Key   string `json:"key"`
	Value []byte `json:"value"`
}

func (Message) MarshalBinary

func (m Message) MarshalBinary() (data []byte, err error)

type SubscribeHandler

type SubscribeHandler func(msg *Message)

Directories

Path Synopsis
example
memory command
redis command

Jump to

Keyboard shortcuts

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