You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
sub, err=c.js.PullSubscribe(subj, durableName)
iferr!=nil {
// handle err
}
ifmsgs, err:=sub.Fetch(100, n.MaxWait(2*time.Second)); err!=nil {
// now nats.ErrConsumerLeadershipChanged ("nats: Leadership Changed") encounteredvalid:=sub.IsValid()
// What would the valid be?
}
Would the subscription instance be closed?
// IsValid returns a boolean indicating whether the subscription// is still active. This will return false if the subscription has// already been closed.func (s*Subscription) IsValid() bool {
ifs==nil {
returnfalse
}
s.mu.Lock()
defers.mu.Unlock()
returns.conn!=nil&&!s.closed
}
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I got such code:
Would the subscription instance be closed?
Beta Was this translation helpful? Give feedback.
All reactions