go-api-boilerplate: github.com/vardius/go-api-boilerplate/pkg/eventbus Index | Files | Directories

package eventbus

import "github.com/vardius/go-api-boilerplate/pkg/eventbus"

Package eventbus provides interfaces along with helper functions

Index

Package Files

doc.go event_bus.go

type EventBus Uses

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 Uses

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

EventHandler function

Directories

PathSynopsis
memory
pubsub
pushpull

Package eventbus imports 2 packages (graph) and is imported by 8 packages. Updated 2020-12-06. Refresh now. Tools for package owners.