(ctx context.Context, stream, consumer string)
| 3511 | } |
| 3512 | |
| 3513 | func (js *js) getConsumerInfoContext(ctx context.Context, stream, consumer string) (*ConsumerInfo, error) { |
| 3514 | ccInfoSubj := fmt.Sprintf(apiConsumerInfoT, stream, consumer) |
| 3515 | resp, err := js.apiRequestWithContext(ctx, js.apiSubj(ccInfoSubj), nil) |
| 3516 | if err != nil { |
| 3517 | if errors.Is(err, ErrNoResponders) { |
| 3518 | err = ErrJetStreamNotEnabled |
| 3519 | } |
| 3520 | return nil, err |
| 3521 | } |
| 3522 | |
| 3523 | var info consumerResponse |
| 3524 | if err := json.Unmarshal(resp.Data, &info); err != nil { |
| 3525 | return nil, err |
| 3526 | } |
| 3527 | if info.Error != nil { |
| 3528 | if errors.Is(info.Error, ErrConsumerNotFound) { |
| 3529 | return nil, ErrConsumerNotFound |
| 3530 | } |
| 3531 | if errors.Is(info.Error, ErrStreamNotFound) { |
| 3532 | return nil, ErrStreamNotFound |
| 3533 | } |
| 3534 | return nil, info.Error |
| 3535 | } |
| 3536 | if info.Error == nil && info.ConsumerInfo == nil { |
| 3537 | return nil, ErrConsumerNotFound |
| 3538 | } |
| 3539 | return info.ConsumerInfo, nil |
| 3540 | } |
| 3541 | |
| 3542 | // a RequestWithContext with tracing via TraceCB |
| 3543 | func (js *js) apiRequestWithContext(ctx context.Context, subj string, data []byte) (*Msg, error) { |
no test coverage detected