unifrost: github.com/unifrost/unifrost/drivers/natsdriver Index | Files

package natsdriver

import "github.com/unifrost/unifrost/drivers/natsdriver"


Package Files


type Client Uses

type Client struct {
    // contains filtered or unexported fields

Client handles the subscriptions to NATS subjects

func NewClient Uses

func NewClient(ctx context.Context, conn *nats.Conn, opts ...Option) (*Client, error)

NewClient returns *natsdriver.Client, manages subscription to NATS subjects.

Additional configuration options can be added with natsdriver.Option functions.

func (*Client) Close Uses

func (client *Client) Close(ctx context.Context) error

Close closes the connection to NATS server

func (*Client) Subscribe Uses

func (client *Client) Subscribe(ctx context.Context, subject string) (*pubsub.Subscription, error)

Subscribe subscribes to the NATS subject

type Option Uses

type Option func(*Client) error

Option is a self-refrential function for configuration parameters

Package natsdriver imports 4 packages (graph). Updated 2020-03-03. Refresh now. Tools for package owners.