(ctx context.Context, js *jetStream, stream, name string)
| 408 | } |
| 409 | |
| 410 | func fetchConsumerInfo(ctx context.Context, js *jetStream, stream, name string) (*ConsumerInfo, error) { |
| 411 | ctx, cancel := js.wrapContextWithoutDeadline(ctx) |
| 412 | if cancel != nil { |
| 413 | defer cancel() |
| 414 | } |
| 415 | if err := validateConsumerName(name); err != nil { |
| 416 | return nil, err |
| 417 | } |
| 418 | infoSubject := fmt.Sprintf(apiConsumerInfoT, stream, name) |
| 419 | |
| 420 | var resp consumerInfoResponse |
| 421 | |
| 422 | if _, err := js.apiRequestJSON(ctx, infoSubject, &resp); err != nil { |
| 423 | return nil, err |
| 424 | } |
| 425 | if resp.Error != nil { |
| 426 | if resp.Error.ErrorCode == JSErrCodeConsumerNotFound { |
| 427 | return nil, ErrConsumerNotFound |
| 428 | } |
| 429 | return nil, resp.Error |
| 430 | } |
| 431 | if resp.Error == nil && resp.ConsumerInfo == nil { |
| 432 | return nil, ErrConsumerNotFound |
| 433 | } |
| 434 | |
| 435 | return resp.ConsumerInfo, nil |
| 436 | } |
| 437 | |
| 438 | func deleteConsumer(ctx context.Context, js *jetStream, stream, consumer string) error { |
| 439 | ctx, cancel := js.wrapContextWithoutDeadline(ctx) |
no test coverage detected