mirror of
https://github.com/spring-projects/spring-boot.git
synced 2024-08-29 03:06:45 +08:00
Fix handling of JMS listener concurrency properties
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
This commit is contained in:
parent
98bfaf0412
commit
366607f517
@ -198,8 +198,7 @@ public class JmsProperties {
|
|||||||
if (this.concurrency == null) {
|
if (this.concurrency == null) {
|
||||||
return (this.maxConcurrency != null) ? "1-" + this.maxConcurrency : null;
|
return (this.maxConcurrency != null) ? "1-" + this.maxConcurrency : null;
|
||||||
}
|
}
|
||||||
return ((this.maxConcurrency != null) ? this.concurrency + "-" + this.maxConcurrency
|
return this.concurrency + "-" + ((this.maxConcurrency != null) ? this.maxConcurrency : this.concurrency);
|
||||||
: String.valueOf(this.concurrency));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Duration getReceiveTimeout() {
|
public Duration getReceiveTimeout() {
|
||||||
|
@ -41,7 +41,7 @@ class JmsPropertiesTests {
|
|||||||
void formatConcurrencyOnlyLowerBound() {
|
void formatConcurrencyOnlyLowerBound() {
|
||||||
JmsProperties properties = new JmsProperties();
|
JmsProperties properties = new JmsProperties();
|
||||||
properties.getListener().setConcurrency(2);
|
properties.getListener().setConcurrency(2);
|
||||||
assertThat(properties.getListener().formatConcurrency()).isEqualTo("2");
|
assertThat(properties.getListener().formatConcurrency()).isEqualTo("2-2");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
Loading…
Reference in New Issue
Block a user