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;
|
||||
|
||||
/**
|
||||
* Timeout to use for receive calls. By default, the listener uses a 1s timeout on
|
||||
* its polling loop. See
|
||||
* @see org.springframework.jms.listener.AbstractPollingMessageListenerContainer#setReceiveTimeout
|
||||
* for more details on this value and the meaning of special values 0 and -1.
|
||||
* Timeout to use for receive calls. Use -1 for a no-wait receive or 0 for no
|
||||
* timeout at all. The latter is only feasible if not running within a transaction
|
||||
* manager and is generally discouraged since it prevents clean shutdown.
|
||||
*/
|
||||
private Duration receiveTimeout;
|
||||
private Duration receiveTimeout = Duration.ofSeconds(1);
|
||||
|
||||
public boolean isAutoStartup() {
|
||||
return this.autoStartup;
|
||||
|
|
|
@ -20,6 +20,8 @@ import java.time.Duration;
|
|||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.jms.listener.AbstractPollingMessageListenerContainer;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
/**
|
||||
|
@ -78,4 +80,10 @@ class JmsPropertiesTests {
|
|||
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