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

Set consumer state to running after brokers and partitions are assigned #340

Merged
merged 1 commit into from
May 13, 2019

Conversation

dubee
Copy link
Member

@dubee dubee commented May 13, 2019

Currently the provider sets the consumer state to running when polling begins. However, this is not an accurate state as the call to subscribe a consumer is non-blocking. Meaning polling can begin before a consumer is connected to any brokers or assigned partitions, resulting in the consumer being set to a running state even though it is not possible to consumer messages yet. This can be problematic for integration tests that check the consumer health endpoint to see if a consumer is in a proper running state prior to producing test messages. To rectify this problem, the changes here set the consumer state to running only after brokers and partitions are assigned to the consumer.

@dubee dubee requested a review from jasonpet May 13, 2019 17:32
@dubee dubee changed the title Set consumer state to running after brokers are connected Set consumer state to running after brokers and partitions are assigned May 13, 2019
@dubee
Copy link
Member Author

dubee commented May 13, 2019

To further explain, there may be interference by an unrelated consumer hanging around that is connected to the topic being used to test with, the actual test consumer may never receive messages produced by the test as the other consumer that is hanging around will consume the message before the test consumer is even connected to brokers and partitions. Waiting for the test consumer to connect to brokers and be assigned partitions before settings its state to running will result in both consumers receiving the message produced by a test eliminating the interference by unrelated consumers.

Copy link
Contributor

@jasonpet jasonpet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@jasonpet jasonpet merged commit 30f549d into apache:master May 13, 2019
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

Successfully merging this pull request may close these issues.

None yet

2 participants