Fix Hang in JMS Test
- add a timeout for template.receive() - don't cache consumers
This commit is contained in:
@@ -104,6 +104,7 @@ public class AsyncGatewayTests {
|
||||
this.gateway2.start();
|
||||
this.gateway2.handleMessage(MessageBuilder.withPayload("foo").setErrorChannel(errors).build());
|
||||
JmsTemplate template = new JmsTemplate(this.ccf);
|
||||
template.setReceiveTimeout(10000);
|
||||
final Message received = template.receive("asyncTest3");
|
||||
assertNotNull(received);
|
||||
org.springframework.messaging.Message<?> error = errors.receive(10000);
|
||||
@@ -124,6 +125,7 @@ public class AsyncGatewayTests {
|
||||
this.gateway2.start();
|
||||
this.gateway2.handleMessage(MessageBuilder.withPayload("foo").setErrorChannel(errors).build());
|
||||
JmsTemplate template = new JmsTemplate(this.ccf);
|
||||
template.setReceiveTimeout(10000);
|
||||
final Message received = template.receive("asyncTest3");
|
||||
assertNotNull(received);
|
||||
org.springframework.messaging.Message<?> error = errors.receive(1000);
|
||||
@@ -137,8 +139,10 @@ public class AsyncGatewayTests {
|
||||
|
||||
@Bean
|
||||
public CachingConnectionFactory ccf() {
|
||||
return new CachingConnectionFactory(
|
||||
CachingConnectionFactory cachingConnectionFactory = new CachingConnectionFactory(
|
||||
new ActiveMQConnectionFactory("vm://localhost?broker.persistent=false"));
|
||||
cachingConnectionFactory.setCacheConsumers(false);
|
||||
return cachingConnectionFactory;
|
||||
}
|
||||
|
||||
@Bean
|
||||
|
||||
Reference in New Issue
Block a user