streamnative / pulsar-client-go

Apache Pulsar Go Client Library
https://pulsar.apache.org/
Apache License 2.0
1 stars 2 forks source link

ISSUE-650: Producer handle ReceivedSendReceipt will close cnx when response sequenceID is not equal pendingQueue msg sequenceID #235

Open sijie opened 2 years ago

sijie commented 2 years ago

Original Issue: apache/pulsar-client-go#650


Producer handle ReceivedSendReceipt will close cnx when response sequenceID is not equal pendingQueue msg sequenceID code is this:

if pi.sequenceID != response.GetSequenceId() {
        // if we receive a receipt that is not the one expected, the state of the broker and the producer differs.
        // At that point, it is better to close the connection to the broker to reconnect to a broker hopping it solves
        // the state discrepancy.
        p.log.Warnf("Received ack for %v on sequenceId %v - expected: %v, closing connection", response.GetMessageId(),
            response.GetSequenceId(), pi.sequenceID)
        p.cnx.Close()
        return
    }

This processing method is more violent, and it will cause a large number of reconnections in the scene of response timeout.

In addition, this processing method is different from java client