mbus

package module
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2022 License: BSD-2-Clause Imports: 5 Imported by: 3

README

Installation

Linux only because of the sd package. sd logs to the systemd journal. sd is only used in one place.

go get github.com/aletheia7/sd
go get github.com/k-sone/critbitgo

License

Use of this source code is governed by a BSD-2-Clause license that can be found in the LICENSE file.

BSD-2-Clause License

Documentation

Overview

Provides a message bus for publish/subscribe messaging.

Index

Constants

View Source
const (
	Sub_channel_prefix   = "sub_"
	Unsub_channel_prefix = "unsub_"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Bus

type Bus struct {
	Drop_slow_consumers bool
	// contains filtered or unexported fields
}

func New_bus

func New_bus(ctx context.Context, warner interface{}) *Bus

func (*Bus) Next

func (o *Bus) Next() string

func (*Bus) Pub

func (o *Bus) Pub(topic string, data interface{})

Pub makes and publishes a new Msg. topic must not be nil. data should be a *data.

func (*Bus) Pubm

func (o *Bus) Pubm(m *Msg)

func (*Bus) Subscribe

func (o *Bus) Subscribe(c chan *Msg, topics ...string)

func (*Bus) Unsubscribe

func (o *Bus) Unsubscribe(c chan *Msg, topics ...string)

type Msg

type Msg struct {
	Topic string
	Data  interface{}
}

func New_msg

func New_msg(topic string, data interface{}) *Msg

New_msg makes a new Msg Msg is not published Data should be a *data

type Warner added in v1.1.0

type Warner interface {
	Warning(a ...interface{})
}

Jump to

Keyboard shortcuts

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