Skip to content

Commit

Permalink
Fix handling of JMS listener concurrency properties
Browse files Browse the repository at this point in the history
Update JMS listener concurrency configuration to set the same minimum
and maximum number of consumers when users specify only the minimum
using `spring.jms.listener.concurrency` property.

Prior to this commit, when using `spring.jms.listener.concurrency` to
set the minimum number of consumers without also specifying
`spring.jms.listener.max-concurrency` would result in effective
concurrency where the actual minimum number of consumers is always 1,
while the maximum number of consumers is the value of
`spring.jms.listener.concurrency`.

See gh-37180
  • Loading branch information
vpavic authored and wilkinsona committed Sep 22, 2023
1 parent 98bfaf0 commit 366607f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -198,8 +198,7 @@ public String formatConcurrency() {
if (this.concurrency == null) {
return (this.maxConcurrency != null) ? "1-" + this.maxConcurrency : null;
}
return ((this.maxConcurrency != null) ? this.concurrency + "-" + this.maxConcurrency
: String.valueOf(this.concurrency));
return this.concurrency + "-" + ((this.maxConcurrency != null) ? this.maxConcurrency : this.concurrency);
}

public Duration getReceiveTimeout() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ void formatConcurrencyNull() {
void formatConcurrencyOnlyLowerBound() {
JmsProperties properties = new JmsProperties();
properties.getListener().setConcurrency(2);
assertThat(properties.getListener().formatConcurrency()).isEqualTo("2");
assertThat(properties.getListener().formatConcurrency()).isEqualTo("2-2");
}

@Test
Expand Down

0 comments on commit 366607f

Please sign in to comment.