You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@rocketmq.apache.org by GitBox <gi...@apache.org> on 2020/12/10 11:52:38 UTC

[GitHub] [rocketmq-spring] RongtongJin commented on issue #322: rocketmq-spring在消费端如何控制重试次数

RongtongJin commented on issue #322:
URL: https://github.com/apache/rocketmq-spring/issues/322#issuecomment-742473996


   Like this:
   ```java
   /**
    * StringConsumer
    */
   @Service
   @RocketMQMessageListener(topic = "${demo.rocketmq.topic}", consumerGroup = "string_consumer", selectorExpression = "${demo.rocketmq.tag}")
   public class StringConsumer implements RocketMQListener<String> , RocketMQPushConsumerLifecycleListener {
       @Override
       public void onMessage(String message) {
           System.out.printf("------- StringConsumer received: %s \n", message);
       }
   
       public void prepareStart(DefaultMQPushConsumer consumer) {
           consumer.setMaxReconsumeTimes(4);
       }
   }
   ```


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