Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type JSStreamLimits ¶
type JSStreamLimits struct {
// MaxConsumers is the max number of consumers allowed on the stream
MaxConsumers *int `json:"max_consumers,omitempty" validate:"omitempty,gte=-1"`
// MaxMsgs is the max number of messages the stream will store.
//
// Oldest messages are removed once limit breached.
MaxMsgs *int64 `json:"max_msgs,omitempty" validate:"omitempty,gte=-1"`
// MaxBytes is the max number of message bytes the stream will store.
//
// Oldest messages are removed once limit breached.
MaxBytes *int64 `json:"max_bytes,omitempty" validate:"omitempty,gte=-1"`
// MaxAge is the max duration (ns) the stream will store a message
//
// Messages breaching the limit will be removed.
MaxAge *time.Duration `json:"max_age,omitempty" swaggertype:"primitive,integer"`
// MaxMsgsPerSubject is the maximum number of subjects allowed on this stream
MaxMsgsPerSubject *int64 `json:"max_msgs_per_subject,omitempty" validate:"omitempty,gte=-1"`
// MaxMsgSize is the max size of a message allowed in this stream
MaxMsgSize *int32 `json:"max_msg_size,omitempty" validate:"omitempty,gte=-1"`
}
JSStreamLimits is the set of stream data retention settings
type JSStreamParam ¶
type JSStreamParam struct {
// Name is the stream name
Name string `json:"name" validate:"required,alphanum|uuid"`
// Subjects is the list of subjects of interest for this stream
Subjects []string `json:"subjects,omitempty"`
// JSStreamLimits stream data retention limits
JSStreamLimits
}
JSStreamParam are the parameters for defining a stream
type JetStreamConsumerParam ¶
type JetStreamConsumerParam struct {
// Name is the consumer name
Name string `json:"name" validate:"required,alphanum|uuid"`
// Notes are descriptions regarding this consumer
Notes string `json:"notes,omitempty"`
// FilterSubject sets the consumer to filter for subjects matching this NATs subject string
//
// See https://docs.nats.io/nats-concepts/subjects
FilterSubject *string `json:"filter_subject,omitempty"`
// DeliveryGroup creates a consumer using a delivery group name.
//
// A consumer using delivery group allows multiple clients to subscribe under the same consumer
// and group name tuple. For subjects this consumer listens to, the messages will be shared
// amongst the connected clients.
DeliveryGroup *string `json:"delivery_group,omitempty" validate:"omitempty,alphanum|uuid"`
// MaxInflight is max number of un-ACKed message permitted in-flight (must be >= 1)
MaxInflight int `json:"max_inflight" validate:"required,gte=1"`
// MaxRetry max number of times an un-ACKed message is resent (-1: infinite)
MaxRetry *int `json:"max_retry,omitempty" validate:"omitempty,gte=-1"`
// AckWait when specified, the number of ns to wait for ACK before retry
AckWait *time.Duration `json:"ack_wait,omitempty" swaggertype:"primitive,integer"`
// Mode whether the consumer is push or pull consumer
Mode string `json:"mode" validate:"required,oneof=push pull"`
}
JetStreamConsumerParam are the parameters for defining a consumer on a stream
type JetStreamController ¶
type JetStreamController interface {
// Ready indicates whether the system is considered ready
Ready() (bool, error)
// CreateStream creates a new stream given parameters
CreateStream(ctxt context.Context, param JSStreamParam) error
// GetAllStreams queries for info on all available streams
GetAllStreams(ctxt context.Context) map[string]*nats.StreamInfo
// GetStream queries for info on one stream by name
GetStream(ctxt context.Context, name string) (*nats.StreamInfo, error)
// ChangeStreamSubjects changes the target subjects of a stream
ChangeStreamSubjects(ctxt context.Context, stream string, newSubjects []string) error
// UpdateStreamLimits changes the data retention limits of the stream
UpdateStreamLimits(ctxt context.Context, stream string, newLimits JSStreamLimits) error
// Deletestream deletes a stream by name
DeleteStream(ctxt context.Context, name string) error
// CreateConsumerForStream creates a new consumer for a stream
CreateConsumerForStream(ctxt context.Context, stream string, param JetStreamConsumerParam) error
// GetAllConsumersForStream queries for info on all consumers of a stream
GetAllConsumersForStream(ctxt context.Context, stream string) map[string]*nats.ConsumerInfo
// GetConsumerForStream queries for info of one consumer of a stream
GetConsumerForStream(
ctxt context.Context, stream, consumerName string,
) (*nats.ConsumerInfo, error)
// DeleteConsumerOnStream deletes one consumer of a stream
DeleteConsumerOnStream(ctxt context.Context, stream, consumerName string) error
}
JetStreamController is a JetStream controller instance. It proxes the commands to JetStream.
func GetJetStreamController ¶
func GetJetStreamController( natsCore *core.NatsClient, instance string, ) (JetStreamController, error)
GetJetStreamController define a jetStreamControllerImpl
Click to show internal directories.
Click to hide internal directories.