You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@rocketmq.apache.org by "Yelijah (via GitHub)" <gi...@apache.org> on 2024/02/21 03:17:39 UTC

[I] [Bug] the consumer wouldn't receive msg when i set consumeGroup's retryTime as -1 [rocketmq]

Yelijah opened a new issue, #7842:
URL: https://github.com/apache/rocketmq/issues/7842

   ### Before Creating the Bug Report
   
   - [X] I found a bug, not just asking a question, which should be created in [GitHub Discussions](https://github.com/apache/rocketmq/discussions).
   
   - [X] I have searched the [GitHub Issues](https://github.com/apache/rocketmq/issues) and [GitHub Discussions](https://github.com/apache/rocketmq/discussions)  of this repository and believe that this is not a duplicate.
   
   - [X] I have confirmed that this bug belongs to the current repository, not other repositories of RocketMQ.
   
   
   ### Runtime platform environment
   
   macos 13.2.1 cpu:x86_64
   
   ### RocketMQ version
   
   server version: 5.1.4
   java client version: 5.0.5
   
   ### JDK Version
   
   openjdk version "1.8.0_265"
   
   ### Describe the Bug
   
   I want my consumer can retry infinitely, so I create a consumeGroup with retryTime as -1 which command like:
   ```
    ./bin/mqadmin updateSubGroup -n 127.0.0.1:9876 -c standalone -g fifoRetryInfinitelyConsumerGroup4 -o true -r -1        
   create subscription group to 192.168.250.2:10911 success.
   SubscriptionGroupConfig{groupName=fifoRetryInfinitelyConsumerGroup4, consumeEnable=true, consumeFromMinEnable=false, consumeBroadcastEnable=false, consumeMessageOrderly=true, retryQueueNums=1, retryMaxTimes=-1, groupRetryPolicy=GroupRetryPolicy{type=CUSTOMIZED, exponentialRetryPolicy=null, customizedRetryPolicy=null}, brokerId=0, whichBrokerWhenConsumeSlowly=1, notifyConsumerIdsChangedEnable=true, groupSysFlag=0, consumeTimeoutMinute=15, subscriptionDataSet=null, attributes={}}% 
   ```
   My consumer is like:
   ```
       @Test
       public void consumeFiFoMsgRetryInfinitely() throws Exception {
           consumeFifoMsg("fifoTopic", "fifoRetryInfinitelyConsumerGroup4", "消息5");
       }
   
       private void consumeFifoMsg(String topic, String consumerGroup, String retryMsg) throws ClientException, InterruptedException, IOException {
           PushConsumer consumer = provider.newPushConsumerBuilder()
                   .setConsumerGroup(consumerGroup)
                   .setClientConfiguration(clientConfiguration)
                   .setConsumptionThreadCount(2)  
                   .setSubscriptionExpressions(Collections.singletonMap(topic, new FilterExpression()))
                   .setMessageListener(new MessageListener() {
                       private final Random random = new Random();
                       @Override
                       public ConsumeResult consume(MessageView messageView) {
                           CommonUtils.log("receive msg:%s", messageView);
                           CommonUtils.sleep(random.nextInt(5));
                           if (retryMsg != null && ByteBufferUtils.toString(messageView.getBody()).startsWith(retryMsg)) {
                               CommonUtils.log("consume failed  msg:%s", messageView);
                               return ConsumeResult.FAILURE;
                           } else {
                               CommonUtils.log("consume success msg:%s", messageView);
                           }
                           return ConsumeResult.SUCCESS;
                       }}
                   ).build();
           Thread.sleep(3600 * 1000);
           consumer.close();
       }
   ```
   
   But the consumer can't receive any message at all. 
   
   
   ### Steps to Reproduce
   
   just like the describation
   
   ### What Did You Expect to See?
   
   I want my consumer can consume successfully , and retry infinitely when error happens.
   
   ### What Did You See Instead?
   
   My consumer can't receive msg at all.
   
   ### Additional Context
   
   _No response_


-- 
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: commits-unsubscribe@rocketmq.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] [Bug] the consumer wouldn't receive msg when i set consumeGroup's retryTime as -1 [rocketmq]

Posted by "Yelijah (via GitHub)" <gi...@apache.org>.
Yelijah commented on issue #7842:
URL: https://github.com/apache/rocketmq/issues/7842#issuecomment-1958891202

   > FIFO topic + FIFO consumer?
   > 
   > this scene,will etry infinitely,do not set anything in consumerGroup config
   > 
   > or normal topic,normal consumer
   
   FIFO topic + FIFO consumer. 
   As [the 5.x doc](https://rocketmq.apache.org/zh/docs/featureBehavior/10consumerretrypolicy) says, fifo consumer also has it's max retry attempts. 


-- 
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: commits-unsubscribe@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] [Bug] the consumer wouldn't receive msg when i set consumeGroup's retryTime as -1 [rocketmq]

Posted by "leizhiyuan (via GitHub)" <gi...@apache.org>.
leizhiyuan commented on issue #7842:
URL: https://github.com/apache/rocketmq/issues/7842#issuecomment-1958577456

   FIFO topic + FIFO consumer?
   
   this scene,will etry infinitely,do not set anything in consumerGroup config
   
   or normal topic,normal consumer
   


-- 
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: commits-unsubscribe@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] [Bug] the consumer wouldn't receive msg when i set consumeGroup's retryTime as -1 [rocketmq]

Posted by "leizhiyuan (via GitHub)" <gi...@apache.org>.
leizhiyuan commented on issue #7842:
URL: https://github.com/apache/rocketmq/issues/7842#issuecomment-1960899636

   Setting it to -1 here is useless. You can set it to a very large value, such as setting it to int max value, to achieve the desired effect.


-- 
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: commits-unsubscribe@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] [Bug] the consumer wouldn't receive msg when i set consumeGroup's retryTime as -1 [rocketmq]

Posted by "Yelijah (via GitHub)" <gi...@apache.org>.
Yelijah closed issue #7842: [Bug] the consumer wouldn't receive msg  when i set consumeGroup's retryTime as -1
URL: https://github.com/apache/rocketmq/issues/7842


-- 
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: commits-unsubscribe@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org