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/07/11 07:52:37 UTC
[GitHub] [rocketmq] JunLu1003 opened a new issue #2152: [DefaultLitePullConsumerImpl] There is no way to know whether the consumer has closed.
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:
users@infra.apache.org
[GitHub] [rocketmq] RongtongJin commented on issue #2152: [DefaultLitePullConsumerImpl] There is no way to know whether the consumer has closed.
Posted by GitBox <gi...@apache.org>.
RongtongJin commented on issue #2152:
URL: https://github.com/apache/rocketmq/issues/2152#issuecomment-657346129
IMO, it is necessary to add such a method. Could you submit a PR to fix it ?
----------------------------------------------------------------
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
[GitHub] [rocketmq] RongtongJin closed issue #2152: [DefaultLitePullConsumerImpl] There is no way to know whether the consumer has closed.
Posted by GitBox <gi...@apache.org>.
RongtongJin closed issue #2152:
URL: https://github.com/apache/rocketmq/issues/2152
----------------------------------------------------------------
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
[GitHub] [rocketmq] zongtanghu commented on issue #2152: [DefaultLitePullConsumerImpl] There is no way to know whether the consumer has closed.
Posted by GitBox <gi...@apache.org>.
zongtanghu commented on issue #2152:
URL: https://github.com/apache/rocketmq/issues/2152#issuecomment-662831784
Can you submit a PR to fix this issue? @zhangjidi2016
----------------------------------------------------------------
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
[GitHub] [rocketmq] RongtongJin edited a comment on issue #2152: [DefaultLitePullConsumerImpl] There is no way to know whether the consumer has closed.
Posted by GitBox <gi...@apache.org>.
RongtongJin edited a comment on issue #2152:
URL: https://github.com/apache/rocketmq/issues/2152#issuecomment-657346129
IMO, it is necessary to add such a method. Could you submit a PR to fix it?
----------------------------------------------------------------
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