rueian commented on a change in pull request #497:
URL: https://github.com/apache/pulsar-client-go/pull/497#discussion_r654155400



##########
File path: pulsar/consumer.go
##########
@@ -165,6 +165,9 @@ type Consumer interface {
        // Unsubscribe the consumer
        Unsubscribe() error
 
+       // Closed returns a channel indicating that consumer is closed
+       Closed() <-chan struct{}
+

Review comment:
       Hi @omnilight, I am run into the same problem and thank you for 
providing a fix.
   
   However, I think the new `Closed()` method is quite hard to use. why not 
just close the `Chan()` and let `Receive()` return an error?

##########
File path: pulsar/consumer.go
##########
@@ -165,6 +165,9 @@ type Consumer interface {
        // Unsubscribe the consumer
        Unsubscribe() error
 
+       // Closed returns a channel indicating that consumer is closed
+       Closed() <-chan struct{}
+

Review comment:
       Hi @omnilight, I run into the same problem and thank you for providing a 
fix.
   
   However, I think the new `Closed()` method is quite hard to use. why not 
just close the `Chan()` and let `Receive()` return an error?

##########
File path: pulsar/consumer.go
##########
@@ -165,6 +165,9 @@ type Consumer interface {
        // Unsubscribe the consumer
        Unsubscribe() error
 
+       // Closed returns a channel indicating that consumer is closed
+       Closed() <-chan struct{}
+

Review comment:
       Oh, I see https://github.com/apache/pulsar-client-go/pull/303 mentioned 
that the `Chan()` can't be closed.
   
   BTW, can you also add a log message when `maxRetry` reached and saying that 
it will not continue retry?

##########
File path: pulsar/consumer.go
##########
@@ -165,6 +165,9 @@ type Consumer interface {
        // Unsubscribe the consumer
        Unsubscribe() error
 
+       // Closed returns a channel indicating that consumer is closed
+       Closed() <-chan struct{}
+

Review comment:
       Oh, I see https://github.com/apache/pulsar-client-go/pull/303 mentioned 
that the `Chan()` can't be closed.
   
   BTW, can you also add a log message when `maxRetry` reached and saying that 
it will not continue reconnecting?




-- 
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]


Reply via email to