pubsub

package
v0.0.8 Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2023 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package pubsub wraps nats calls

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidActorURN      = errors.New("invalid actor urn")
	ErrInvalidTenantURN     = errors.New("invalid tenant urn")
	ErrInvalidAssignmentURN = errors.New("invalid assignment urn")
	ErrInvalidURN           = errors.New("invalid urn")
)

nolint

Functions

func NewAssignmentMessage

func NewAssignmentMessage(actorURN string, tenantURN string, assignmentURN string, additionalSubjectURNs ...string) (*pubsubx.Message, error)

NewAssignmentMessage creates a new assignment message

func NewAssignmentURN

func NewAssignmentURN(assignmentID string) string

NewAssignmentURN creates a new assignment URN

func NewLoadBalancerMessage

func NewLoadBalancerMessage(actorURN string, tenantURN string, loadBalancerURN string, additionalSubjectURNs ...string) (*pubsubx.Message, error)

NewLoadBalancerMessage creates a new loadbalancer message

func NewLoadBalancerURN

func NewLoadBalancerURN(loadBalancerID string) string

NewLoadBalancerURN creates a new loadbalancer URN

Types

type Client added in v0.0.8

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

Client is an event bus client with some configuration

func NewClient added in v0.0.8

func NewClient(opts ...Option) *Client

NewClient configures and establishes a new event bus client connection

func (*Client) AddStream added in v0.0.8

func (c *Client) AddStream() (*nats.StreamInfo, error)

AddStream checks if a stream exists and attempts to create it if it doesn't. Currently we don't currently check that the stream is configured identically to the desired configuration.

func (*Client) PublishCreate added in v0.0.8

func (c *Client) PublishCreate(ctx context.Context, actor, location string, data *pubsubx.Message) error

PublishCreate publishes a create event

func (*Client) PublishDelete added in v0.0.8

func (c *Client) PublishDelete(ctx context.Context, actor, location string, data *pubsubx.Message) error

PublishDelete publishes a delete event

func (*Client) PublishUpdate added in v0.0.8

func (c *Client) PublishUpdate(ctx context.Context, actor, location string, data *pubsubx.Message) error

PublishUpdate publishes an update event

type Option added in v0.0.8

type Option func(c *Client)

Option is a functional configuration option for governor eventing

func WithJetreamContext added in v0.0.8

func WithJetreamContext(js nats.JetStreamContext) Option

WithJetreamContext sets the nats jetstream context

func WithLogger added in v0.0.8

func WithLogger(l *zap.SugaredLogger) Option

WithLogger sets the client logger

func WithStreamName added in v0.0.8

func WithStreamName(s string) Option

WithStreamName sets the nats stream name

func WithSubjectPrefix added in v0.0.8

func WithSubjectPrefix(p string) Option

WithSubjectPrefix sets the nats subject prefix

Jump to

Keyboard shortcuts

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