Versions in this module Expand all Collapse all v0 v0.7.0 Sep 16, 2020 Changes in this version + const DefaultACKPrefix + const DefaultAckWait + const DefaultConnectWait + const DefaultDiscoverPrefix + const DefaultMaxInflight + const DefaultMaxPubAcksInflight + const DefaultNatsURL + const DefaultPingInterval + const DefaultPingMaxOut + const DefaultRequestTopic + const Version + var DefaultOptions = getDefaultOptions() + var DefaultSubscriptionOptions = SubscriptionOptions + var ErrBadAck = errors.New("stan: malformed ack") + var ErrBadConnection = errors.New("stan: invalid connection") + var ErrBadSubscription = errors.New("stan: invalid subscription") + var ErrCloseReqTimeout = errors.New("stan: close request timeout") + var ErrConnectReqTimeout = errors.New("stan: connect request timeout (possibly wrong cluster ID?)") + var ErrConnectionClosed = errors.New("stan: connection closed") + var ErrManualAck = errors.New("stan: cannot manually ack in auto-ack mode") + var ErrMaxPings = errors.New("stan: connection lost due to PING failure") + var ErrNilMsg = errors.New("stan: nil message") + var ErrNoServerSupport = errors.New("stan: not supported by server") + var ErrSubReqTimeout = errors.New("stan: subscribe request timeout") + var ErrTimeout = errors.New("stan: publish ack timeout") + var ErrUnsubReqTimeout = errors.New("stan: unsubscribe request timeout") + func WrapperSync(cb MsgHandler, t string) variable.MessageHandler + type AckHandler func(string, error) + type Conn interface + Close func() error + GetServer func() *variable.WatchServer + GetSession func() *variable.Subscribe + NatsConn func() *nats.Conn + Publish func(subject string, data []byte) error + PublishAsync func(subject string, data []byte, ah AckHandler) (string, error) + QueueSubscribe func(subject, qgroup string, cb MsgHandler, opts ...SubscriptionOption) (Subscription, error) + QueueSubscribePromote func(subject string, cb MsgHandler, opts ...SubscriptionOption) (Subscription, error) + Subscribe func(subject string, cb MsgHandler, opts ...SubscriptionOption) (Subscription, error) + func Connect(stanClusterID, clientID string, options ...Option) (Conn, error) + type ConnectionLostHandler func(Conn, error) + type Msg struct + Sub Subscription + func (msg *Msg) Ack() error + type MsgHandler func(msg *Msg) + func WrapperCb(sc *conn, cb MsgHandler, t string) MsgHandler + type Option func(*Options) error + func ConnectWait(t time.Duration) Option + func MaxPubAcksInflight(max int) Option + func NatsConn(nc *nats.Conn) Option + func NatsURL(u string) Option + func Pings(interval, maxOut int) Option + func PubAckWait(t time.Duration) Option + func SetConnectionLostHandler(handler ConnectionLostHandler) Option + type Options struct + AckTimeout time.Duration + ConnectTimeout time.Duration + ConnectionLostCB ConnectionLostHandler + DiscoverPrefix string + MaxPubAcksInflight int + NatsConn *nats.Conn + NatsURL string + PingInterval int + PingIterval int + PingMaxOut int + func GetDefaultOptions() Options + type Subscription interface + ClearMaxPending func() error + Close func() error + Delivered func() (int64, error) + Dropped func() (int, error) + IsValid func() bool + MaxPending func() (int, int, error) + Pending func() (int, int, error) + PendingLimits func() (int, int, error) + SetPendingLimits func(msgLimit, bytesLimit int) error + Unsubscribe func() error + type SubscriptionOption func(*SubscriptionOptions) error + func AckWait(t time.Duration) SubscriptionOption + func DeliverAllAvailable() SubscriptionOption + func DurableName(name string) SubscriptionOption + func MaxInflight(m int) SubscriptionOption + func SetManualAckMode() SubscriptionOption + func StartAt(sp pb.StartPosition) SubscriptionOption + func StartAtSequence(seq uint64) SubscriptionOption + func StartAtTime(start time.Time) SubscriptionOption + func StartAtTimeDelta(ago time.Duration) SubscriptionOption + func StartWithLastReceived() SubscriptionOption + type SubscriptionOptions struct + AckWait time.Duration + DurableName string + ManualAcks bool + MaxInflight int + StartAt pb.StartPosition + StartSequence uint64 + StartTime time.Time