pzhx521 opened a new issue, #1044:
URL: https://github.com/apache/rocketmq-client-go/issues/1044

   I noticed that PullConsumer has the following interface: 
   ```golang
   Subscribe(topic string, selector consumer.MessageSelector) error
   Pull(ctx context.Context, numbers int) (*primitive.PullResult, error)
   ```
   When I subscribe to multiple topics using the same consumer. Calling the 
`pull` method, I cannot figure out which topic's data is being pulled.
   
   The business requirement is to use a pull mode consumer to subscribe to 
multiple topics.
   
   The pseudocode is as follows:
   
   ```goalng
   var nameSrv, _ = primitive.NewNamesrvAddr(nameServerAddr)
   pullConsumer, _ := mqcliv2.NewPullConsumer(
        consumer.WithGroupName("test"),
        consumer.WithNameServer(nameSrv),
        ...
   )
   var topics := queryFormDB(...)
   topics.range(func(item) {
       go func() {
       pullConsumer.Subscribe(topic,...)
       .....
   
       }
   })
   
   pullConsumer.Start()
   ....
   ```
   
   At this point, when I execute the `pullConsumer.Pull(...)` method, it is no 
longer semantically certain which topic's data is being pulled. (However, topic 
data can be indirectly obtained from the return value data), as is well known, 
the reason for this is that every call to Subscribe will reassign `pc. 
topic=topic`(https://github.com/apache/rocketmq-client-go/blob/8ea107c9b0ffb8aea61b9ea581899023a7b9b5a6/consumer/pull_consumer.go#LL132C12-L132C12).
 The calling order of Subscribe is unclear, and the final value of `pc.topic` 
cannot be determined.
   
   Therefore, I believe that the semantics of the PULL method are not very 
clear. It only means obtaining data from the latest pc.topic. thank you.
   We look forward to your reply.


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