eventbus

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Oct 1, 2022 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Await

func Await(ctx context.Context, bus event.Bus, names ...string) (<-chan event.Event, <-chan error, error)

Await is a shortcut for NewAwaiter(bus).Once(ctx, names...). See Awaiter.Once for documentation.

func New

func New() event.Bus

Types

type Awaiter

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

Awaiter can be used to await events in more complex scenarios.

func NewAwaiter

func NewAwaiter(bus event.Bus) Awaiter

NewAwaiter returns an Awaiter for the given Bus.

func (Awaiter) Once

func (a Awaiter) Once(ctx context.Context, names ...string) (<-chan event.Event, <-chan error, error)

Once subscribes to the given events over the event bus and returns a channel for the event and an error channel. The returned Event channels will never receive more than one element (either a single Event or a single error). When an Event or an error is received, both channels are immediately closed.

If len(names) == 0, Once returns nil channels.

Directories

Path Synopsis
Package natsbus provides an event.Bus implementation with support for both NATS Core and NATS Streaming as the backend.
Package natsbus provides an event.Bus implementation with support for both NATS Core and NATS Streaming as the backend.

Jump to

Keyboard shortcuts

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