diff --git a/server/consumer.go b/server/consumer.go index 43efb274..38e24f5f 100644 --- a/server/consumer.go +++ b/server/consumer.go @@ -166,7 +166,9 @@ func (r ReplayPolicy) String() string { // Ack responses. Note that a nil or no payload is same as AckAck var ( // Ack - AckAck = []byte(OK) // nil or no payload to ack subject also means ACK + AckAck = []byte("+ACK") // nil or no payload to ack subject also means ACK + AckOK = []byte(OK) // deprecated but +OK meant ack as well. + // Nack AckNak = []byte("-NAK") // Progress indicator @@ -595,7 +597,7 @@ func (o *Consumer) processAck(_ *subscription, _ *client, subject, reply string, sseq, dseq, dcount, _ := o.ReplyInfo(subject) switch { - case len(msg) == 0, bytes.Equal(msg, AckAck): + case len(msg) == 0, bytes.Equal(msg, AckAck), bytes.Equal(msg, AckOK): o.ackMsg(sseq, dseq, dcount) case bytes.Equal(msg, AckNext): o.ackMsg(sseq, dseq, dcount) diff --git a/server/stream.go b/server/stream.go index 0b1585ee..ac698482 100644 --- a/server/stream.go +++ b/server/stream.go @@ -157,9 +157,9 @@ func (a *Account) AddStreamWithStore(config *StreamConfig, fsConfig *FileStoreCo // Create our pubAck here. This will be reused and for +OK will contain JSON // for stream name and sequence. longestSeq := strconv.FormatUint(math.MaxUint64, 10) - lpubAck := len(AckAck) + len(cfg.Name) + len("{\"stream\": ,\"seq\": }") + len(longestSeq) + lpubAck := len(OK) + len(cfg.Name) + len("{\"stream\": ,\"seq\": }") + len(longestSeq) mset.pubAck = make([]byte, 0, lpubAck) - mset.pubAck = append(mset.pubAck, AckAck...) + mset.pubAck = append(mset.pubAck, OK...) mset.pubAck = append(mset.pubAck, fmt.Sprintf(" {\"stream\": %q, \"seq\": ", cfg.Name)...) return mset, nil