reugn commented on a change in pull request #109: Fix subscriber bug and use 
Consumer interface for multi topic consumer.
URL: https://github.com/apache/pulsar-client-go/pull/109#discussion_r352281715
 
 

 ##########
 File path: pulsar/consumer_multitopic.go
 ##########
 @@ -45,54 +45,32 @@ func newMultiTopicConsumer(client *client, options 
ConsumerOptions, topics []str
        mtc := &multiTopicConsumer{
                options:   options,
                messageCh: messageCh,
-               consumers: make(map[string]*consumer, len(topics)),
+               consumers: make(map[string]Consumer, len(topics)),
                closeCh:   make(chan struct{}),
                log:       &log.Entry{},
        }
 
-       type ConsumerError struct {
-               err      error
-               topic    string
-               consumer *consumer
-       }
-
-       var wg sync.WaitGroup
-       wg.Add(len(topics))
-       ch := make(chan ConsumerError, len(topics))
-       for i := range topics {
-               go func(t string) {
-                       defer wg.Done()
-                       c, err := internalTopicSubscribe(client, options, t, 
messageCh)
-                       ch <- ConsumerError{
-                               err:      err,
-                               topic:    t,
-                               consumer: c,
-                       }
-               }(topics[i])
-       }
-
-       go func() {
-               wg.Wait()
-               close(ch)
-       }()
-
        var errs error
-       for ce := range ch {
+       consumers := make(map[string]Consumer, len(topics))
 
 Review comment:
   Why do we need temporary consumers value here?

----------------------------------------------------------------
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:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to