Documentation ¶
Index ¶
- type Client
- func (c *Client) BindKVStore(kvName string) (nats.KeyValue, error)
- func (c *Client) Close()
- func (c *Client) JetStreamContext(opts ...nats.JSOpt) (nats.JetStreamContext, error)
- func (c *Client) PendingForStream(consumer string, stream string) (int64, error)
- func (c *Client) Subscribe(subject string, stream string, opts ...nats.SubOpt) (*nats.Subscription, error)
- type ClientPool
- type Option
- type Options
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶ added in v1.1.6
Client is a client for NATS server which be shared by multiple connections (reader, writer, kv, buffer management, etc.)
func NewNATSClient ¶ added in v0.9.0
NewNATSClient Create a new NATS client
func NewTestClient ¶ added in v0.9.0
NewTestClient creates a new NATS client for testing only use this for testing
func (*Client) BindKVStore ¶ added in v1.1.6
BindKVStore lookup and bind to an existing KeyValue store and return the KeyValue interface
func (*Client) JetStreamContext ¶ added in v1.1.6
JetStreamContext returns a new JetStreamContext
func (*Client) PendingForStream ¶ added in v1.1.6
PendingForStream returns the number of pending messages for the given consumer and stream
type ClientPool ¶ added in v0.9.0
type ClientPool struct {
// contains filtered or unexported fields
}
ClientPool is a pool of NATS clients used on at the initial create connection phase.
func NewClientPool ¶ added in v0.9.0
func NewClientPool(ctx context.Context, opts ...Option) (*ClientPool, error)
NewClientPool returns a new pool of NATS clients of the given size
func (*ClientPool) CloseAll ¶ added in v0.9.0
func (p *ClientPool) CloseAll()
CloseAll closes all the clients in the pool
func (*ClientPool) NextAvailableClient ¶ added in v0.9.0
func (p *ClientPool) NextAvailableClient() *Client
NextAvailableClient returns the next available NATS client. This code need not be optimized because this is not in hot code path. It is only during connection creation/startup.
type Option ¶ added in v0.9.0
type Option func(*Options)
Option is a function on the options for a NATS client pool
func WithClientPoolSize ¶ added in v0.9.0
WithClientPoolSize sets the size of the NATS client pool