eventbus

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package eventbus provides access to an eventbus where governor events can be published. Currently, the only concrete implementation is a NATS client.

Index

Constants

This section is empty.

Variables

View Source
var ErrEmptyEvent = errors.New("event is empty")

ErrEmptyEvent is returned when an empty event is passed

Functions

This section is empty.

Types

type Client

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

Client is an event bus client with some configuration

func NewClient

func NewClient(opts ...Option) *Client

NewClient configures and establishes a new event bus client connection

func (*Client) Publish

func (c *Client) Publish(ctx context.Context, sub string, event *events.Event) error

Publish an event on the event bus

func (*Client) Shutdown

func (c *Client) Shutdown() error

Shutdown drains the event bus and closes the connections

type Option

type Option func(c *Client)

Option is a functional configuration option for governor eventing

func WithLogger

func WithLogger(l *zap.Logger) Option

WithLogger sets the client logger

func WithNATSConn

func WithNATSConn(nc conn) Option

WithNATSConn sets the nats connection

func WithNATSPrefix

func WithNATSPrefix(p string) Option

WithNATSPrefix sets the nats subscription prefix

Jump to

Keyboard shortcuts

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