InitialConsumerPending returns the number of messages pending to be delivered to the consumer when the subscription was created.
()
| 2060 | // InitialConsumerPending returns the number of messages pending to be |
| 2061 | // delivered to the consumer when the subscription was created. |
| 2062 | func (sub *Subscription) InitialConsumerPending() (uint64, error) { |
| 2063 | sub.mu.Lock() |
| 2064 | defer sub.mu.Unlock() |
| 2065 | if sub.jsi == nil || sub.jsi.consumer == _EMPTY_ { |
| 2066 | return 0, fmt.Errorf("%w: not a JetStream subscription", ErrTypeSubscription) |
| 2067 | } |
| 2068 | return sub.jsi.pending, nil |
| 2069 | } |
| 2070 | |
| 2071 | // This long-lived routine is used per ChanSubscription to check |
| 2072 | // on the number of delivered messages and check for flow control response. |