streaming

package
v1.4.6 Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2021 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const EmptyGUID = ""

EmptyGUID "".

Variables

View Source
var (
	DefaultClusterID = "test-cluster"
	EmptyHandler     = func(*Msg, Serializable) {}
)

nolint golint

View Source
var (
	// ErrNilNatsConn pure nats is nil, check usage library.
	ErrNilNatsConn = errors.New("pure nats connection from advance nats client is nil, nc.NatsConn() == nil ")

	// ErrNilNatsClient pure nats client is nil, check usage library.
	ErrNilNatsClient = errors.New("advance nats client is nil")
)

Functions

func New

func New(clusterID string, clientID string, nc nc.SimpleNatsClientI, options ...Option) (*client, error)

New - Create Nats Streaming client with instance of Advance Nats client. nolint golint

func NewOnlyStreaming

func NewOnlyStreaming(clusterID string, clientID string, dsn []URL, options ...Option) (*client, error)

NewOnlyStreaming - create only streaming client. nolint golint

Types

type AckHandler

type AckHandler = stan.AckHandler // func(string, error)

nolint golint

type AdvanceNatsClient

type AdvanceNatsClient interface {
	// NATS @see -> nc.SimpleNatsClientI
	Ping(context.Context, nc.Subj) (bool, error)
	PongHandler(nc.Subj) (*nc.Subscription, error)
	PongQueueHandler(nc.Subj, nc.QueueGroup) (*nc.Subscription, error)
	Request(context.Context, Subj, Serializable, Serializable) error
	ReplyHandler(Subj, Serializable, nc.Handler) (*nc.Subscription, error)
	ReplyQueueHandler(Subj, QueueGroup, Serializable, nc.Handler) (*nc.Subscription, error)
	// NATS Streaming
	PublishSync(Subj, Serializable) error
	PublishAsync(Subj, Serializable, AckHandler) (GUID, error)
	DefaultAckHandler() AckHandler
	Subscribe(Subj, Serializable, Handler, ...SubscriptionOption) (Subscription, error)
	QueueSubscribe(Subj, QueueGroup, Serializable, Handler, ...SubscriptionOption) (Subscription, error)
	// General for both NATS and NATS Streaming
	UseCustomLogger(logger.Logger)
	NatsConn() *nats.Conn
	Nats() nc.SimpleNatsClientI
	Close() error
}

nolint golint

type GUID

type GUID = string // id send msg from Nats Streaming

nolint golint

type Handler

type Handler = func(*stan.Msg, Serializable)

nolint golint

type Msg

type Msg = stan.Msg

nolint golint

type MsgHandler

type MsgHandler = stan.MsgHandler // func(msg *Msg)

nolint golint

type Option

type Option = stan.Option

nolint golint

type PureNatsStunConnI

type PureNatsStunConnI interface {
	Publish(subj string, data []byte) error
	PublishAsync(subj string, data []byte, ackHandler AckHandler) (string, error)
	Subscribe(subj string, msgHandler MsgHandler, subscriptionOptions ...SubscriptionOption) (Subscription, error)
	QueueSubscribe(subj string, queueGroup string, msgHandler MsgHandler, subscriptionOptions ...SubscriptionOption) (Subscription, error)
	Close() error
}

StunConnI represents a connection to the NATS Streaming subsystem. It can Publish and Subscribe to messages within the NATS Streaming cluster. The connection is safe to use in multiple Go routines concurrently.

type QueueGroup added in v1.0.2

type QueueGroup = nc.QueueGroup

nolint golint

type Serializable

type Serializable = serializable.Serializable

nolint golint

type Subj

type Subj = nc.Subj

nolint golint

type Subscription

type Subscription = stan.Subscription

nolint golint

type SubscriptionOption

type SubscriptionOption = stan.SubscriptionOption

nolint golint

type URL

type URL = string

nolint golint

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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