MCPcopy
hub / github.com/nats-io/nats.go / handleStatusMsg

Method handleStatusMsg

jetstream/push.go:180–206  ·  view source on GitHub ↗
(msg *nats.Msg, status, description string)

Source from the content-addressed store, hash-verified

178}
179
180func (s *pushSubscription) handleStatusMsg(msg *nats.Msg, status, description string) (error, bool) {
181 switch status {
182 case statusControlMsg:
183 switch strings.ToLower(description) {
184 case idleHeartbeatDescr:
185 return nil, false
186 case fcRequestDescr:
187 if err := msg.Respond(nil); err != nil {
188 if s.consumeOpts.ErrHandler != nil {
189 s.consumeOpts.ErrHandler(s, err)
190 }
191 }
192 return nil, false
193 }
194 case statusConflict:
195 if description == consumerDeleted {
196 return ErrConsumerDeleted, true
197 }
198 if description == leadershipChange {
199 if s.consumeOpts.ErrHandler != nil {
200 s.consumeOpts.ErrHandler(s, ErrConsumerLeadershipChanged)
201 return ErrConsumerLeadershipChanged, false
202 }
203 }
204 }
205 return nil, false
206}
207
208// Stop unsubscribes from the stream and cancels subscription.
209// No more messages will be received after calling this method.

Callers 1

ConsumeMethod · 0.95

Calls 1

RespondMethod · 0.65

Tested by

no test coverage detected