Documentation ¶
Index ¶
- Constants
- Variables
- func New(clusterID string, clientID string, nc nc.SimpleNatsClientI, options ...Option) (*client, error)
- func NewOnlyStreaming(clusterID string, clientID string, dsn []URL, options ...Option) (*client, error)
- type AckHandler
- type AdvanceNatsClient
- type GUID
- type Handler
- type Msg
- type MsgHandler
- type Option
- type PureNatsStunConnI
- type QueueGroup
- type Serializable
- type Subj
- type Subscription
- type SubscriptionOption
- type URL
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 ¶
Types ¶
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 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.
Click to show internal directories.
Click to hide internal directories.