nats

package
v1.0.0-beta.26 Latest Latest
Warning

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

Go to latest
Published: Aug 10, 2023 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HelperModule

func HelperModule(extraOptions fx.Option) fx.Option

HelperModule returns fx module for initialization of helper to start NATS client for handlers.

The module is only loaded once.

func QueueValue

func QueueValue() string

QueueValue returns the queue from the configuration via "faas.nats.queue" key.

func SubjectsValue

func SubjectsValue() []string

SubjectValue returns the subjects from the configuration via "faas.nats.subjects" key.

Types

type Helper

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

Helper assists in creating event handlers.

func NewDefaultHelper

func NewDefaultHelper(ctx context.Context, conn *nats.Conn, handler *cloudevents.HandlerWrapper) *Helper

NewDefaultHelper returns a new Helper with default options.

func NewHelper

func NewHelper(ctx context.Context, conn *nats.Conn, options *Options,
	handler *cloudevents.HandlerWrapper) *Helper

NewHelper returns a new Helper with options.

func (*Helper) Start

func (h *Helper) Start()

type Options

type Options struct {
	Subjects []string
	Queue    string
}

Options can be used to create customized handler.

func DefaultOptions

func DefaultOptions() (*Options, error)

DefaultOptions returns options based in config.

type SubscriberListener

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

SubscriberListener represents a subscriber listener.

func NewSubscriberListener

func NewSubscriberListener(q *nats.Conn, handler *cloudevents.HandlerWrapper, subject string,
	queue string) *SubscriberListener

NewSubscriberListener returns a subscriber listener.

func (*SubscriberListener) Subscribe

func (l *SubscriberListener) Subscribe(ctx context.Context) (*nats.Subscription, error)

Subscribe subscribes to a particular subject in the listening subscriber's queue.

Jump to

Keyboard shortcuts

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