Info fetches current ConsumerInfo from the server.
(ctx context.Context)
| 219 | |
| 220 | // Info fetches current ConsumerInfo from the server. |
| 221 | func (p *pushConsumer) Info(ctx context.Context) (*ConsumerInfo, error) { |
| 222 | ctx, cancel := p.js.wrapContextWithoutDeadline(ctx) |
| 223 | if cancel != nil { |
| 224 | defer cancel() |
| 225 | } |
| 226 | infoSubject := fmt.Sprintf(apiConsumerInfoT, p.stream, p.name) |
| 227 | var resp consumerInfoResponse |
| 228 | |
| 229 | if _, err := p.js.apiRequestJSON(ctx, infoSubject, &resp); err != nil { |
| 230 | return nil, err |
| 231 | } |
| 232 | if resp.Error != nil { |
| 233 | if resp.Error.ErrorCode == JSErrCodeConsumerNotFound { |
| 234 | return nil, ErrConsumerNotFound |
| 235 | } |
| 236 | return nil, resp.Error |
| 237 | } |
| 238 | if resp.Error == nil && resp.ConsumerInfo == nil { |
| 239 | return nil, ErrConsumerNotFound |
| 240 | } |
| 241 | |
| 242 | p.info = resp.ConsumerInfo |
| 243 | return resp.ConsumerInfo, nil |
| 244 | } |
| 245 | |
| 246 | // CachedInfo returns ConsumerInfo currently cached on this consumer. |
| 247 | // This method does not perform any network requests. The cached |
nothing calls this directly
no test coverage detected