wolfstudy commented on issue #157: [issue:144] Add retry logic when get connection error URL: https://github.com/apache/pulsar-client-go/pull/157#issuecomment-570133088 the output of local test case as follows: ``` to creat room consumer SubscriptionName:sub-name-7 ..... ===========read connection from cached============= INFO[0142] Connecting to broker remote_addr="pulsar://159.65.2.188:6650" WARN[0142] Failed to connect to broker. error="dial tcp 159.65.2.188:6650: connect: network is unreachable" remote_addr="pulsar://159.65.2.188:6650" INFO[0142] Connection closed remote_addr="pulsar://159.65.2.188:6650" Reconnecting to broker in {100ms} ===========read connection from cached============= INFO[0142] Connecting to broker remote_addr="pulsar://159.65.2.188:6650" WARN[0142] Failed to connect to broker. error="dial tcp 159.65.2.188:6650: connect: network is unreachable" remote_addr="pulsar://159.65.2.188:6650" INFO[0142] Connection closed remote_addr="pulsar://159.65.2.188:6650" Reconnecting to broker in {200ms} ===========read connection from cached============= INFO[0143] Connecting to broker remote_addr="pulsar://159.65.2.188:6650" WARN[0143] Failed to connect to broker. error="dial tcp 159.65.2.188:6650: connect: network is unreachable" remote_addr="pulsar://159.65.2.188:6650" INFO[0143] Connection closed remote_addr="pulsar://159.65.2.188:6650" Reconnecting to broker in {400ms} ===========read connection from cached============= INFO[0143] Connecting to broker remote_addr="pulsar://159.65.2.188:6650" WARN[0143] Failed to connect to broker. error="dial tcp 159.65.2.188:6650: connect: network is unreachable" remote_addr="pulsar://159.65.2.188:6650" INFO[0143] Connection closed remote_addr="pulsar://159.65.2.188:6650" Reconnecting to broker in {800ms} ===========read connection from cached============= INFO[0144] Connecting to broker remote_addr="pulsar://159.65.2.188:6650" WARN[0144] Failed to connect to broker. error="dial tcp 159.65.2.188:6650: connect: network is unreachable" remote_addr="pulsar://159.65.2.188:6650" INFO[0144] Connection closed remote_addr="pulsar://159.65.2.188:6650" Reconnecting to broker in {1.6s} ===========read connection from cached============= INFO[0145] Connecting to broker remote_addr="pulsar://159.65.2.188:6650" WARN[0145] Failed to connect to broker. error="dial tcp 159.65.2.188:6650: connect: network is unreachable" remote_addr="pulsar://159.65.2.188:6650" INFO[0145] Connection closed remote_addr="pulsar://159.65.2.188:6650" Reconnecting to broker in {3.2s} ===========read connection from cached============= INFO[0149] Connecting to broker remote_addr="pulsar://159.65.2.188:6650" INFO[0150] TCP connection established local_addr="192.168.55.163:57054" remote_addr="pulsar://159.65.2.188:6650" INFO[0151] Connection is ready local_addr="192.168.55.163:57054" remote_addr="pulsar://159.65.2.188:6650" retry connection success... ===========read connection from cached============= ===========read connection from cached============= INFO[0152] Connected consumer name=arlhe subscription=sub-name-7 topic="persistent://public/default/7" INFO[0152] Created consumer name=arlhe subscription=sub-name-7 topic="persistent://public/default/7" creat room consumer done, SubscriptionName:sub-name-7 ***creat done wait group -- 7 done to close room sub-name-7..... INFO[0158] Closing consumer=7 name=arlhe subscription=sub-name-7 topic="persistent://public/default/7" WARN[0158] Failed to close consumer error="server error: MetadataError: Consumer not found" name=arlhe subscription=sub-name-7 topic="persistent://public/default/7" INFO[0158] exiting events loop name=arlhe subscription=sub-name-7 topic="persistent://public/default/7" to close room [sub-name-7 close done***] INFO[0158] exiting dispatch loop name=arlhe subscription=sub-name-7 topic="persistent://public/default/7" to creat room consumer SubscriptionName:sub-name-8 ..... ===========read connection from cached============= ===========read connection from cached============= ===========read connection from cached============= INFO[0163] Connecting to broker remote_addr="pulsar://159.65.9.22:6650" INFO[0164] TCP connection established local_addr="192.168.55.163:57087" remote_addr="pulsar://159.65.9.22:6650" INFO[0164] Connection is ready local_addr="192.168.55.163:57087" remote_addr="pulsar://159.65.9.22:6650" ===========read connection from cached============= INFO[0165] Connected consumer name=hxwlu subscription=sub-name-8 topic="persistent://public/default/8" INFO[0165] Created consumer name=hxwlu subscription=sub-name-8 topic="persistent://public/default/8" creat room consumer done, SubscriptionName:sub-name-8 ***creat done ```
---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: [email protected] With regards, Apache Git Services
