eventbus

package
v0.0.1-0...-6deec57 Latest Latest
Warning

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

Go to latest
Published: Jun 4, 2022 License: MIT Imports: 2 Imported by: 0

README

eventbus GoDoc

Package eventbus provides event bus interfaces

Download:

go get -u github.com/bradishungry/go-api-learning/pkg/eventbus

Package eventbus provides event bus interfaces

Documentation

Overview

Package eventbus provides interfaces along with helper functions

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EventBus

type EventBus interface {
	Publish(ctx context.Context, event *domain.Event) error
	Subscribe(ctx context.Context, eventType string, fn EventHandler) error
	Unsubscribe(ctx context.Context, eventType string, fn EventHandler) error

	// PublishAndAcknowledge blocks and returns grouped error after all handlers are executed
	PublishAndAcknowledge(parentCtx context.Context, event *domain.Event) error
}

EventBus interface event bus is different to command bus by allowing multiple handlers to the same topic

type EventHandler

type EventHandler func(ctx context.Context, event *domain.Event) error

EventHandler function

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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