Skip to content

Commit

Permalink
[IMPROVED] AddConsumer documentation (#1555)
Browse files Browse the repository at this point in the history
Signed-off-by: Piotr Piotrowski <piotr@synadia.com>
  • Loading branch information
piotrpio committed Feb 14, 2024
1 parent 373f09c commit 4b3ba71
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
2 changes: 1 addition & 1 deletion jetstream/jetstream_options.go
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ func FetchMaxWait(timeout time.Duration) FetchOpt {
//
// Heartbeat value has to be lower than FetchMaxWait / 2.
//
// If not provided, heartbeat will is set to 5s for requests with FetchMaxWait > 30s
// If not provided, heartbeat will is set to 5s for requests with FetchMaxWait > 10s
// and disabled otherwise.
func FetchHeartbeat(hb time.Duration) FetchOpt {
return func(req *pullRequest) error {
Expand Down
10 changes: 9 additions & 1 deletion jsm.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,10 @@ type JetStreamManager interface {
SecureDeleteMsg(name string, seq uint64, opts ...JSOpt) error

// AddConsumer adds a consumer to a stream.
// If the consumer already exists, and the configuration is the same, it
// will return the existing consumer.
// If the consumer already exists, and the configuration is different, it
// will return ErrConsumerNameAlreadyInUse.
AddConsumer(stream string, cfg *ConsumerConfig, opts ...JSOpt) (*ConsumerInfo, error)

// UpdateConsumer updates an existing consumer.
Expand Down Expand Up @@ -329,7 +333,11 @@ type consumerResponse struct {
*ConsumerInfo
}

// AddConsumer will add a JetStream consumer.
// AddConsumer adds a consumer to a stream.
// If the consumer already exists, and the configuration is the same, it
// will return the existing consumer.
// If the consumer already exists, and the configuration is different, it
// will return ErrConsumerNameAlreadyInUse.
func (js *js) AddConsumer(stream string, cfg *ConsumerConfig, opts ...JSOpt) (*ConsumerInfo, error) {
if cfg == nil {
cfg = &ConsumerConfig{}
Expand Down

0 comments on commit 4b3ba71

Please sign in to comment.