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

oldConsumerHolder.getConsumer()已经执行close(),可为何还要assign() #3

Open
xinzhuxiansheng opened this issue Feb 11, 2020 · 0 comments

Comments

@xinzhuxiansheng
Copy link
Contributor

//已经close
closeConsumer(oldConsumerHolder);

        ConsumerHolder newConsumerHolder = getOrAddConsumer(topicId);
        if (oldConsumerHolder.getAssignments() != null) {
            newConsumerHolder.setAssignments(oldConsumerHolder.getAssignments());

// oldCOnsumerHolder.getConsumer() 没必须要assign了吧,作者,这里是笔误? 有点没太明白
oldConsumerHolder.getConsumer().assign(oldConsumerHolder.getAssignments());
} else if (oldConsumerHolder.getConsumerRebalanceListener() != null) {
newConsumerHolder.setConsumerRebalanceListener(oldConsumerHolder.getConsumerRebalanceListener());
newConsumerHolder.getConsumer().subscribe(Arrays.asList(topicId),
oldConsumerHolder.getConsumerRebalanceListener());
} else {
newConsumerHolder.getConsumer().subscribe(Arrays.asList(topicId));
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant