Polish "Add a config property for JMS listener container's receive timeout"
See gh-17332
This commit is contained in:
parent
1cde657861
commit
1f875d552a
|
@ -156,12 +156,11 @@ public class JmsProperties {
|
||||||
private Integer maxConcurrency;
|
private Integer maxConcurrency;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Timeout to use for receive calls. By default, the listener uses a 1s timeout on
|
* Timeout to use for receive calls. Use -1 for a no-wait receive or 0 for no
|
||||||
* its polling loop. See
|
* timeout at all. The latter is only feasible if not running within a transaction
|
||||||
* @see org.springframework.jms.listener.AbstractPollingMessageListenerContainer#setReceiveTimeout
|
* manager and is generally discouraged since it prevents clean shutdown.
|
||||||
* for more details on this value and the meaning of special values 0 and -1.
|
|
||||||
*/
|
*/
|
||||||
private Duration receiveTimeout;
|
private Duration receiveTimeout = Duration.ofSeconds(1);
|
||||||
|
|
||||||
public boolean isAutoStartup() {
|
public boolean isAutoStartup() {
|
||||||
return this.autoStartup;
|
return this.autoStartup;
|
||||||
|
|
|
@ -20,6 +20,8 @@ import java.time.Duration;
|
||||||
|
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
|
import org.springframework.jms.listener.AbstractPollingMessageListenerContainer;
|
||||||
|
|
||||||
import static org.assertj.core.api.Assertions.assertThat;
|
import static org.assertj.core.api.Assertions.assertThat;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -78,4 +80,10 @@ class JmsPropertiesTests {
|
||||||
assertThat(properties.getTemplate().determineQosEnabled()).isTrue();
|
assertThat(properties.getTemplate().determineQosEnabled()).isTrue();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void defaultReceiveTimeoutMatchesListenerContainersDefault() {
|
||||||
|
assertThat(new JmsProperties().getListener().getReceiveTimeout())
|
||||||
|
.isEqualTo(Duration.ofMillis(AbstractPollingMessageListenerContainer.DEFAULT_RECEIVE_TIMEOUT));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue