HScarb commented on issue #535:
URL: 
https://github.com/apache/rocketmq-spring/issues/535#issuecomment-2325551790

   ```java
   @Service
   @RocketMQMessageListener(topic = "topic-1", consumerGroup = "cid-topic")
   public class TopicListener implements RocketMQListener<String>, 
RocketMQPushConsumerLifecycleListener {
   
       @Override
       public void onMessage(String s) {
           System.out.println("received message: " + s);
       }
   
       @Override
       public void prepareStart(DefaultMQPushConsumer defaultMQPushConsumer) {
           try {
               defaultMQPushConsumer.subscribe("topic-1", "*");
               defaultMQPushConsumer.subscribe("topic-2", "*");
           } catch (MQClientException e) {
               throw new RuntimeException(e);
           }
       }
   }
   ```
   
   implement `RocketMQPushConsumerLifecycleListener` and subscribe all topics 
in the `prepareStart` method


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