cckellogg commented on a change in pull request #648:
URL: https://github.com/apache/pulsar-client-go/pull/648#discussion_r735780659



##########
File path: pulsar/producer_partition.go
##########
@@ -350,13 +353,14 @@ func (p *partitionProducer) reconnectToBroker() {
                time.Sleep(d)
                atomic.AddUint64(&p.epoch, 1)
                err := p.grabCnx()
+               p.err = err
                if err == nil {
                        // Successfully reconnected
                        p.log.WithField("cnx", p.cnx.ID()).Info("Reconnected 
producer to broker")
                        return
                }
                errMsg := err.Error()
-               if strings.Contains(errMsg, errTopicNotFount) {
+               if strings.Contains(errMsg, errTopicNotFount) || 
strings.Contains(errMsg,errMetadata){

Review comment:
       Same here we should figure out a better way (not searching a string) to 
determine error types. 
   
   Should the log message be updated as well?

##########
File path: pulsar/consumer_partition.go
##########
@@ -1001,7 +1001,7 @@ func (pc *partitionConsumer) reconnectToBroker() {
                        return
                }
                errMsg := err.Error()
-               if strings.Contains(errMsg, errTopicNotFount) {
+               if strings.Contains(errMsg, errTopicNotFount)  || 
strings.Contains(errMsg,errMetadata){

Review comment:
       Is there a way to check equal on the error types? I don't think we 
should get into the habit of searching strings for substrings to determine the 
error.
   
   Should the log message `Topic not found` be updated as well?

##########
File path: pulsar/producer_partition.go
##########
@@ -60,13 +60,16 @@ var (
 )
 
 var errTopicNotFount = "TopicNotFound"
+var errMetadata = "MetadataError"
+
 
 type partitionProducer struct {
        state  ua.Int32
        client *client
        topic  string
        log    log.Logger
        cnx    internal.Connection
+       err    error

Review comment:
       Why is this needed?




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to