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

Issue-327 Number of consumers should be configurable #399

Merged
merged 2 commits into from
Nov 4, 2022
Merged

Conversation

sbodvanski
Copy link
Contributor

No description provided.

@@ -15,7 +15,7 @@ class ProductListener {

CopyOnWriteArraySet<String> threads = new CopyOnWriteArraySet<>()

@Queue(value = "product", numberOfConsumers = 5) // <1>
@Queue(value = "product", numberOfConcurrentConsumers = "5") // <1>
Copy link
Contributor

Choose a reason for hiding this comment

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

what is the motivation for changing the member name?

Copy link
Contributor Author

@sbodvanski sbodvanski Nov 2, 2022

Choose a reason for hiding this comment

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

I was not 100% sure if that is the proper approach, but I added a new member(numberOfConcurrentConsumers) and deprecated the old one(numberOfConsumers) to avoid breaking the backward compatibility contract. The new member is of type String versus int to allow for config property placeholders.

Copy link
Contributor

@graemerocher graemerocher left a comment

Choose a reason for hiding this comment

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

Perhaps don't deprecate it for type safety a number is still handy. Name it numberOfConsumersValue and this provides the option to use either. You can add @AliasFor("numberOfConsumers") to the new member and then just read it "numberOfConsumers" here (you don't have to check for both) https://github.com/micronaut-projects/micronaut-rabbitmq/pull/399/files#diff-fce8edcc7a5dc02ecf4bf1520cf937dc82991c4fe4571bd3080118152de3c853R137

@sbodvanski
Copy link
Contributor Author

@AliasFor("numberOfConsumers")

Assome, I wasn't aware of the @AliasFor option.

@sonarcloud
Copy link

sonarcloud bot commented Nov 2, 2022

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@graemerocher graemerocher merged commit 28ead35 into master Nov 4, 2022
@graemerocher graemerocher deleted the Issue-327 branch November 4, 2022 12:51
@graemerocher graemerocher added the type: enhancement New feature or request label Nov 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants