Documentation ¶
Index ¶
- Constants
- func ConfigAdd(path string)
- func NewConn(ctx context.Context, plugins ...Plugin) (*nats.Conn, error)
- func NewConnWithConfigPath(ctx context.Context, path string) (*nats.Conn, error)
- func NewConnWithOptions(ctx context.Context, options *Options, plugins ...Plugin) (*nats.Conn, error)
- type Options
- type Plugin
- type Publisher
- func NewPublisher(ctx context.Context, middlewares ...PublisherMiddleware) (*Publisher, error)
- func NewPublisherWithConfigPath(ctx context.Context, path string, middlewares ...PublisherMiddleware) (*Publisher, error)
- func NewPublisherWithOptions(ctx context.Context, options *Options, middlewares ...PublisherMiddleware) (*Publisher, error)
- type PublisherMiddleware
- type Subscriber
- func NewSubscriber(ctx context.Context, msgHandlers ...msgHandler) (*Subscriber, error)
- func NewSubscriberWithConfigPath(ctx context.Context, path string, msgHandlers ...msgHandler) (*Subscriber, error)
- func NewSubscriberWithOptions(ctx context.Context, options *Options, msgHandlers ...msgHandler) (*Subscriber, error)
Constants ¶
const (
PluginsRoot = root + ".plugins"
)
Variables ¶
This section is empty.
Functions ¶
func NewConnWithConfigPath ¶
NewConnWithConfigPath returns a new nats connection with options from config path.
Types ¶
type Options ¶
Options nats connection options.
func NewOptions ¶
NewOptions returns options from config file or environment vars.
func NewOptionsWithPath ¶
NewOptionsWithPath unmarshals a given key path into options and returns it.
type Publisher ¶
type Publisher struct {
// contains filtered or unexported fields
}
Publisher represents a nats publisher.
func NewPublisher ¶
func NewPublisher(ctx context.Context, middlewares ...PublisherMiddleware) (*Publisher, error)
NewPublisher returns a new nats publisher with default options.
func NewPublisherWithConfigPath ¶
func NewPublisherWithConfigPath(ctx context.Context, path string, middlewares ...PublisherMiddleware) (*Publisher, error)
NewPublisherWithConfigPath returns a new nats publisher with options from config path.
func NewPublisherWithOptions ¶
func NewPublisherWithOptions(ctx context.Context, options *Options, middlewares ...PublisherMiddleware) (*Publisher, error)
NewPublisherWithOptions returns a new nats publisher with options.
type PublisherMiddleware ¶
type PublisherMiddleware interface { Before(context.Context, *nats.Conn, *nats.Msg) (context.Context, error) After(context.Context) error }
PublisherMiddleware defines an interface for a nats publisher plugin.
type Subscriber ¶
type Subscriber struct {
// contains filtered or unexported fields
}
Subscriber represents a nats subscriber.
func NewSubscriber ¶
func NewSubscriber(ctx context.Context, msgHandlers ...msgHandler) (*Subscriber, error)
NewSubscriber returns a new nats subscriber with default options.
func NewSubscriberWithConfigPath ¶
func NewSubscriberWithConfigPath(ctx context.Context, path string, msgHandlers ...msgHandler) (*Subscriber, error)
NewSubscriberWithConfigPath returns a new nats subscriber with options from config path.
func NewSubscriberWithOptions ¶
func NewSubscriberWithOptions(ctx context.Context, options *Options, msgHandlers ...msgHandler) (*Subscriber, error)
NewSubscriberWithOptions returns a new nats subscriber with options.
func (*Subscriber) Conn ¶
func (p *Subscriber) Conn() *nats.Conn