MCPcopy
hub / github.com/nats-io/nats.go / getConsumer

Function getConsumer

jetstream/consumer.go:368–388  ·  view source on GitHub ↗
(ctx context.Context, js *jetStream, stream, name string)

Source from the content-addressed store, hash-verified

366}
367
368func getConsumer(ctx context.Context, js *jetStream, stream, name string) (Consumer, error) {
369 info, err := fetchConsumerInfo(ctx, js, stream, name)
370 if err != nil {
371 return nil, err
372 }
373
374 if info.Config.DeliverSubject != "" {
375 return nil, ErrNotPullConsumer
376 }
377
378 cons := &pullConsumer{
379 js: js,
380 stream: stream,
381 name: name,
382 durable: info.Config.Durable != "",
383 info: info,
384 subs: syncx.Map[string, *pullSubscription]{},
385 }
386
387 return cons, nil
388}
389
390func getPushConsumer(ctx context.Context, js *jetStream, stream, name string) (PushConsumer, error) {
391 info, err := fetchConsumerInfo(ctx, js, stream, name)

Callers 2

ConsumerMethod · 0.85
ConsumerMethod · 0.85

Calls 1

fetchConsumerInfoFunction · 0.85

Tested by

no test coverage detected