eventbus

package
v0.0.0-...-fa32389 Latest Latest
Warning

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

Go to latest
Published: Dec 26, 2023 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package eventbus introduces a simple in-memory event bus, in real life scenario, this would need a proper implementation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EventBus

type EventBus struct {
	// contains filtered or unexported fields
}

func NewEventBus

func NewEventBus(bufferSize int) *EventBus

func (*EventBus) Close

func (e *EventBus) Close()

func (*EventBus) Publish

func (e *EventBus) Publish(eventType string, data interface{})

func (*EventBus) Run

func (e *EventBus) Run()

func (*EventBus) Running

func (e *EventBus) Running()

func (*EventBus) Subscribe

func (e *EventBus) Subscribe(eventType string, handler EventHandler)

type EventHandler

type EventHandler func(data interface{})

type NoOpPublisher

type NoOpPublisher struct{}

func (*NoOpPublisher) Publish

func (n *NoOpPublisher) Publish(eventType string, data interface{})

type Publisher

type Publisher interface {
	Publish(eventType string, data interface{})
}

Jump to

Keyboard shortcuts

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