Info fetches current ConsumerInfo from the server.
(ctx context.Context)
| 186 | |
| 187 | // Info fetches current ConsumerInfo from the server. |
| 188 | func (p *pullConsumer) Info(ctx context.Context) (*ConsumerInfo, error) { |
| 189 | ctx, cancel := p.js.wrapContextWithoutDeadline(ctx) |
| 190 | if cancel != nil { |
| 191 | defer cancel() |
| 192 | } |
| 193 | infoSubject := fmt.Sprintf(apiConsumerInfoT, p.stream, p.name) |
| 194 | var resp consumerInfoResponse |
| 195 | |
| 196 | if _, err := p.js.apiRequestJSON(ctx, infoSubject, &resp); err != nil { |
| 197 | return nil, err |
| 198 | } |
| 199 | if resp.Error != nil { |
| 200 | if resp.Error.ErrorCode == JSErrCodeConsumerNotFound { |
| 201 | return nil, ErrConsumerNotFound |
| 202 | } |
| 203 | return nil, resp.Error |
| 204 | } |
| 205 | if resp.Error == nil && resp.ConsumerInfo == nil { |
| 206 | return nil, ErrConsumerNotFound |
| 207 | } |
| 208 | |
| 209 | p.info = resp.ConsumerInfo |
| 210 | return resp.ConsumerInfo, nil |
| 211 | } |
| 212 | |
| 213 | // CachedInfo returns ConsumerInfo currently cached on this consumer. |
| 214 | // This method does not perform any network requests. The cached |
nothing calls this directly
no test coverage detected