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

Function isJSControlMessage

js.go:2125–2137  ·  view source on GitHub ↗

isJSControlMessage will return true if this is an empty control status message and indicate what type of control message it is, say jsCtrlHB or jsCtrlFC

(msg *Msg)

Source from the content-addressed store, hash-verified

2123// isJSControlMessage will return true if this is an empty control status message
2124// and indicate what type of control message it is, say jsCtrlHB or jsCtrlFC
2125func isJSControlMessage(msg *Msg) (bool, int) {
2126 if len(msg.Data) > 0 || msg.Header.Get(statusHdr) != controlMsg {
2127 return false, 0
2128 }
2129 val := msg.Header.Get(descrHdr)
2130 if strings.HasPrefix(val, "Idle") {
2131 return true, jsCtrlHB
2132 }
2133 if strings.HasPrefix(val, "Flow") {
2134 return true, jsCtrlFC
2135 }
2136 return true, 0
2137}
2138
2139// Keeps track of the incoming message's reply subject so that the consumer's
2140// state (deliver sequence, etc..) can be checked against heartbeats.

Callers 3

checkMsgFunction · 0.85
IsJSControlMessageFunction · 0.85
processMsgMethod · 0.85

Calls 1

GetMethod · 0.65

Tested by

no test coverage detected