Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Two consumer instances consume the same message, and some messages are not consumed #107

Closed
whoamigodson opened this issue Jul 26, 2019 · 5 comments
Labels
bug Something isn't working
Milestone

Comments

@whoamigodson
Copy link

No description provided.

@vongosling
Copy link
Member

Please write your questions according to the question template

@vongosling vongosling changed the title 集群消费时两个消费者实例会消费相同的消息,并且一部分消息没被消费 Two consumer instances consume the same message, and some messages are not consumed Jul 26, 2019
@whoamigodson
Copy link
Author

when started two consumer instances consume the same topic message,if two consumer instances is same name,but listen two different port,and some messages are not consumed.

@whoamigodson
Copy link
Author

class ListenerContainerConfiguration
private void registerContainer(String beanName, Object bean) {
Class<?> clazz = AopProxyUtils.ultimateTargetClass(bean);

    if (!RocketMQListener.class.isAssignableFrom(bean.getClass())) {
        throw new IllegalStateException(clazz + " is not instance of " + RocketMQListener.class.getName());
    }

    RocketMQMessageListener annotation = clazz.getAnnotation(RocketMQMessageListener.class);
    validate(annotation);

    String containerBeanName = String.format("%s_%s", DefaultRocketMQListenerContainer.class.getName(),
        counter.incrementAndGet());

so,containerBeanName can config by RocketMQMessageListener?

@whoamigodson
Copy link
Author

In rocketmq-spring,two different consumer process,but client id is same one.how to fix?
clientId 192.168.1.11@org.apache.rocketmq.spring.support.DefaultRocketMQListenerContainer_1
clientAddr
192.168.1.11:52320

clientId
192.168.1.11@org.apache.rocketmq.spring.support.DefaultRocketMQListenerContainer_1
clientAddr
192.168.1.11:52341

@RongtongJin
Copy link
Contributor

@whoamigodson Currently, you can temporarily solve this issue by implementing RocketMQPushConsumerLifecycleListener and setting a unique instanceName in prepareStart. Contributors are welcome to solve this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants