JunLu1003 opened a new issue #2152:
URL: https://github.com/apache/rocketmq/issues/2152


   **BUG REPORT**
   
   1. Please describe the issue you observed:
   
   - What did you do (The steps to reproduce)?
   
   When the project starts, I use DefaultLitePullConsumerImpl as the consumer, 
and call the consumer's poll(long timeout) method to do some logic.
   
   ```java
   public class BizConsumer implements CommandLineRunner {
   
        private DefaultLitePullConsumer consumer;
   
        @Override
         public void run(String... args) throws Exception {
             consumer = new DefaultLitePullConsumer("group-name");
             consumer.setNamesrvAddr("server address");
             consumer.subscribe(...);
             consumer.start();
             SomeClass.executeAsync(consumer);
         }
   
         @PreDestroy
         public void destroy {
             if (consumer != null) {
                 consumer.shutdown();
             }
         }
   }
   ```
   
   ```java
   public class SomeClass {
       @Async
       public void executeAsync(DefaultLitePullConsumer consumer) {
           while (true) {
               /**
                * When Server shutdown, consumer.poll() will throw a Exception
                */
               List<MessageExt> messages = consumer.poll(5 * 1000);
               ....
           }
      }
   }
   ```
   
   when the project is closed, I call the consumer's shutdown method, but the 
consumer's poll(long timeout ) is still running, then I got a Exception: 
java.lang.IllegalStateException: The consumer not running, please start it 
first.
   
   I try to find a isClosed() or isRunning() method in 
DefaultLitePullConsumerImpl class, but I cannot find them.
   
   - What did you expect to see?
   
   Is there a way to know that the consumer client has been closed ?
   
   - What did you see instead?
   
   java.lang.IllegalStateException: The consumer not running, please start it 
first.
   
   2. Please tell us about your environment:
   
   jdk 8
   Springboot 2.2.8
   rocketmq-spring-boot-starter 2.1.0
   CentOS 7
   
   


----------------------------------------------------------------
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:
[email protected]


Reply via email to