Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Connection ¶
type Connection interface { Raw() interface{} CreateSubscription(ctx context.Context, opts *SubscriptionOptions) (Queue, error) CreateTopic(ctx context.Context, opts *TopicOptions) (Topic, error) DeleteSubscription(ctx context.Context, opts *SubscriptionOptions) error }
func NewJetstream ¶
func NewJetstream(js jetstream.JetStream) Connection
func NewPlain ¶
func NewPlain(natsConn *nats.Conn) Connection
type Queue ¶
type Queue interface { // ReceiveMessages pulls messages from the nats queue server. // If no messages are currently available, this method should block for // no more than about 1 second. It can return an empty // slice of messages and no error. ReceiveBatch will be called again // immediately, so implementations should try to wait for messages for some // non-zero amount of time before returning zero messages. If the underlying // service doesn't support waiting, then a time.Sleep can be used. ReceiveMessages(ctx context.Context, batchCount int) ([]*driver.Message, error) Unsubscribe() error Ack(ctx context.Context, ids []driver.AckID) error Nack(ctx context.Context, ids []driver.AckID) error IsQueueGroup() bool }
type SubscriptionOptions ¶
type SubscriptionOptions struct { StreamName string StreamDescription string Subjects []string Durable string ConsumerName string ConsumersMaxCount int ConsumerRequestBatch int ConsumerRequestMaxBatchBytes int ConsumerRequestTimeoutMs int ConsumerAckWaitTimeoutMs int //The maximum number of fetch requests that are all waiting in parallel to receive messages. //This prevents building up too many requests that the server will have to distribute to for a given consumer. ConsumerMaxWaiting int ConsumerMaxRequestExpiresMs int ConsumerMaxAckPending int }
SubscriptionOptions sets options for subscribing to NATS. Stream Options are useful for initial setup especially when creating streams/queues these will later be subscribed to by the consumers of nats messages. The appropriate *pubsub.Subscription is created as a result here.
type TopicOptions ¶
type TopicOptions struct {
Subject string
}
TopicOptions sets options for constructing a *pubsub.Topic backed by NATS.
Click to show internal directories.
Click to hide internal directories.