Documentation ¶
Overview ¶
Package pubsub wraps nats calls
Index ¶
- Constants
- Variables
- func NewAssignmentMessage(actorURN string, tenantURN string, assignmentURN string, ...) (*pubsubx.Message, error)
- func NewAssignmentURN(id string) string
- func NewFrontendMessage(actorURN string, tenantURN string, frontendURN string, ...) (*pubsubx.Message, error)
- func NewFrontendURN(id string) string
- func NewLoadBalancerMessage(actorURN string, tenantURN string, loadBalancerURN string, ...) (*pubsubx.Message, error)
- func NewLoadBalancerURN(id string) string
- func NewOriginMessage(actorURN string, tenantURN string, originURN string, ...) (*pubsubx.Message, error)
- func NewOriginURN(id string) string
- func NewPoolMessage(actorURN string, tenantURN string, poolURN string, ...) (*pubsubx.Message, error)
- func NewPoolURN(id string) string
- func NewTenantURN(id string) string
- type Client
- func (c *Client) AddStream() (*nats.StreamInfo, error)
- func (c *Client) ChanSubscribe(ctx context.Context, sub string, ch chan *nats.Msg, stream string) (*nats.Subscription, error)
- func (c *Client) PublishCreate(ctx context.Context, actor, location string, data *pubsubx.Message) error
- func (c *Client) PublishDelete(ctx context.Context, actor, location string, data *pubsubx.Message) error
- func (c *Client) PublishUpdate(ctx context.Context, actor, location string, data *pubsubx.Message) error
- type Option
Constants ¶
const ( // CreateEventType is the create event type string CreateEventType = "create" // DeleteEventType is the delete event type string DeleteEventType = "delete" // UpdateEventType is the update event type string UpdateEventType = "update" )
Variables ¶
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 event message
func NewAssignmentURN ¶
NewAssignmentURN creates a new assignment URN
func NewFrontendMessage ¶ added in v0.0.9
func NewFrontendMessage(actorURN string, tenantURN string, frontendURN string, additionalSubjectURNs ...string) (*pubsubx.Message, error)
NewFrontendMessage creates a new frontend message
func NewFrontendURN ¶ added in v0.0.9
NewFrontendURN creates a new frontend URN
func NewLoadBalancerMessage ¶
func NewLoadBalancerMessage(actorURN string, tenantURN string, loadBalancerURN string, additionalSubjectURNs ...string) (*pubsubx.Message, error)
NewLoadBalancerMessage creates a new loadbalancer event message
func NewLoadBalancerURN ¶
NewLoadBalancerURN creates a new load balancer URN
func NewOriginMessage ¶ added in v0.0.9
func NewOriginMessage(actorURN string, tenantURN string, originURN string, additionalSubjectURNs ...string) (*pubsubx.Message, error)
NewOriginMessage creates a new origin message
func NewOriginURN ¶ added in v0.0.9
NewOriginURN creates a new origin URN
func NewPoolMessage ¶ added in v0.0.9
func NewPoolMessage(actorURN string, tenantURN string, poolURN string, additionalSubjectURNs ...string) (*pubsubx.Message, error)
NewPoolMessage creates a new pool event message
func NewPoolURN ¶ added in v0.0.9
NewPoolURN creates a new pool URN
func NewTenantURN ¶ added in v0.0.9
NewTenantURN creates a new tenant 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
NewClient configures and establishes a new event bus client connection
func (*Client) AddStream ¶ added in v0.0.8
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) ChanSubscribe ¶ added in v0.0.9
func (c *Client) ChanSubscribe(ctx context.Context, sub string, ch chan *nats.Msg, stream string) (*nats.Subscription, error)
ChanSubscribe creates a subcription and returns messages on a channel
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
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
WithStreamName sets the nats stream name
func WithSubjectPrefix ¶ added in v0.0.8
WithSubjectPrefix sets the nats subject prefix