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

Function deleteConsumer

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

Source from the content-addressed store, hash-verified

436}
437
438func deleteConsumer(ctx context.Context, js *jetStream, stream, consumer string) error {
439 ctx, cancel := js.wrapContextWithoutDeadline(ctx)
440 if cancel != nil {
441 defer cancel()
442 }
443 if err := validateConsumerName(consumer); err != nil {
444 return err
445 }
446 deleteSubject := fmt.Sprintf(apiConsumerDeleteT, stream, consumer)
447
448 var resp consumerDeleteResponse
449
450 if _, err := js.apiRequestJSON(ctx, deleteSubject, &resp); err != nil {
451 return err
452 }
453 if resp.Error != nil {
454 if resp.Error.ErrorCode == JSErrCodeConsumerNotFound {
455 return ErrConsumerNotFound
456 }
457 return resp.Error
458 }
459 return nil
460}
461
462func pauseConsumer(ctx context.Context, js *jetStream, stream, consumer string, pauseUntil *time.Time) (*ConsumerPauseResponse, error) {
463 ctx, cancel := js.wrapContextWithoutDeadline(ctx)

Callers 2

DeleteConsumerMethod · 0.85
DeleteConsumerMethod · 0.85

Calls 3

validateConsumerNameFunction · 0.85
apiRequestJSONMethod · 0.80

Tested by

no test coverage detected