Merge pull request #37180 from vpavic

* gh-37180:
  Polish "Fix handling of JMS listener concurrency properties"
  Fix handling of JMS listener concurrency properties

Closes gh-37180
2.7.x
Andy Wilkinson 1 year ago
commit 7b0885b8b2

@ -146,7 +146,8 @@ public class JmsProperties {
private AcknowledgeMode acknowledgeMode; private AcknowledgeMode acknowledgeMode;
/** /**
* Minimum number of concurrent consumers. * Minimum number of concurrent consumers. When max-concurrency is not specified
* the minimum will also be used as the maximum.
*/ */
private Integer concurrency; private Integer concurrency;
@ -198,8 +199,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…
Cancel
Save