Skip to content

Commit 433bd33

Browse files
vpavicmhalbritter
authored andcommitted
Rename JMS listener minimum concurrency property
This commit renames `spring.jms.listener.concurrency` property to `spring.jms.listener.min-concurrency` in order to better align it with `spring.jms.listener.max-concurrency`. See gh-37451
1 parent 2015046 commit 433bd33

File tree

3 files changed

+21
-9
lines changed

3 files changed

+21
-9
lines changed

spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jms/JmsProperties.java

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
import java.time.Duration;
2020

2121
import org.springframework.boot.context.properties.ConfigurationProperties;
22+
import org.springframework.boot.context.properties.DeprecatedConfigurationProperty;
2223

2324
/**
2425
* Configuration properties for JMS.
@@ -148,7 +149,7 @@ public static class Listener {
148149
/**
149150
* Minimum number of concurrent consumers.
150151
*/
151-
private Integer concurrency;
152+
private Integer minConcurrency;
152153

153154
/**
154155
* Maximum number of concurrent consumers.
@@ -178,12 +179,23 @@ public void setAcknowledgeMode(AcknowledgeMode acknowledgeMode) {
178179
this.acknowledgeMode = acknowledgeMode;
179180
}
180181

182+
@DeprecatedConfigurationProperty(replacement = "spring.jms.listener.min-concurrency", since = "3.2.0")
183+
@Deprecated(since = "3.2.0", forRemoval = true)
181184
public Integer getConcurrency() {
182-
return this.concurrency;
185+
return this.minConcurrency;
183186
}
184187

188+
@Deprecated(since = "3.2.0", forRemoval = true)
185189
public void setConcurrency(Integer concurrency) {
186-
this.concurrency = concurrency;
190+
this.minConcurrency = concurrency;
191+
}
192+
193+
public Integer getMinConcurrency() {
194+
return this.minConcurrency;
195+
}
196+
197+
public void setMinConcurrency(Integer minConcurrency) {
198+
this.minConcurrency = minConcurrency;
187199
}
188200

189201
public Integer getMaxConcurrency() {
@@ -195,11 +207,11 @@ public void setMaxConcurrency(Integer maxConcurrency) {
195207
}
196208

197209
public String formatConcurrency() {
198-
if (this.concurrency == null) {
210+
if (this.minConcurrency == null) {
199211
return (this.maxConcurrency != null) ? "1-" + this.maxConcurrency : null;
200212
}
201-
return ((this.maxConcurrency != null) ? this.concurrency + "-" + this.maxConcurrency
202-
: String.valueOf(this.concurrency));
213+
return ((this.maxConcurrency != null) ? this.minConcurrency + "-" + this.maxConcurrency
214+
: String.valueOf(this.minConcurrency));
203215
}
204216

205217
public Duration getReceiveTimeout() {

spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jms/JmsAutoConfigurationTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ void jmsListenerContainerFactoryWhenMultipleConnectionFactoryBeansShouldBackOff(
143143
void testJmsListenerContainerFactoryWithCustomSettings() {
144144
this.contextRunner.withUserConfiguration(EnableJmsConfiguration.class)
145145
.withPropertyValues("spring.jms.listener.autoStartup=false", "spring.jms.listener.acknowledgeMode=client",
146-
"spring.jms.listener.concurrency=2", "spring.jms.listener.receiveTimeout=2s",
146+
"spring.jms.listener.minConcurrency=2", "spring.jms.listener.receiveTimeout=2s",
147147
"spring.jms.listener.maxConcurrency=10")
148148
.run(this::testJmsListenerContainerFactoryWithCustomSettings);
149149
}

spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jms/JmsPropertiesTests.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ void formatConcurrencyNull() {
4040
@Test
4141
void formatConcurrencyOnlyLowerBound() {
4242
JmsProperties properties = new JmsProperties();
43-
properties.getListener().setConcurrency(2);
43+
properties.getListener().setMinConcurrency(2);
4444
assertThat(properties.getListener().formatConcurrency()).isEqualTo("2");
4545
}
4646

@@ -54,7 +54,7 @@ void formatConcurrencyOnlyHigherBound() {
5454
@Test
5555
void formatConcurrencyBothBounds() {
5656
JmsProperties properties = new JmsProperties();
57-
properties.getListener().setConcurrency(2);
57+
properties.getListener().setMinConcurrency(2);
5858
properties.getListener().setMaxConcurrency(10);
5959
assertThat(properties.getListener().formatConcurrency()).isEqualTo("2-10");
6060
}

0 commit comments

Comments
 (0)