mirror of
https://github.com/spring-projects/spring-framework.git
synced 2026-05-02 20:09:31 +01:00
Make sure endpoint settings override default factory settings
Issue: SPR-16338
This commit is contained in:
+2
-2
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2002-2015 the original author or authors.
|
* Copyright 2002-2018 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -200,8 +200,8 @@ public abstract class AbstractJmsListenerContainerFactory<C extends AbstractMess
|
|||||||
instance.setAutoStartup(this.autoStartup);
|
instance.setAutoStartup(this.autoStartup);
|
||||||
}
|
}
|
||||||
|
|
||||||
endpoint.setupListenerContainer(instance);
|
|
||||||
initializeContainer(instance);
|
initializeContainer(instance);
|
||||||
|
endpoint.setupListenerContainer(instance);
|
||||||
|
|
||||||
return instance;
|
return instance;
|
||||||
}
|
}
|
||||||
|
|||||||
+16
-1
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2002-2015 the original author or authors.
|
* Copyright 2002-2018 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -149,6 +149,21 @@ public class JmsListenerContainerFactoryTests {
|
|||||||
assertSame(backOff, new DirectFieldAccessor(container).getPropertyValue("backOff"));
|
assertSame(backOff, new DirectFieldAccessor(container).getPropertyValue("backOff"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void endpointConcurrencyTakesPrecedence() {
|
||||||
|
DefaultJmsListenerContainerFactory factory = new DefaultJmsListenerContainerFactory();
|
||||||
|
factory.setConcurrency("2-10");
|
||||||
|
|
||||||
|
SimpleJmsListenerEndpoint endpoint = new SimpleJmsListenerEndpoint();
|
||||||
|
MessageListener messageListener = new MessageListenerAdapter();
|
||||||
|
endpoint.setMessageListener(messageListener);
|
||||||
|
endpoint.setDestination("myQueue");
|
||||||
|
endpoint.setConcurrency("4-6");
|
||||||
|
DefaultMessageListenerContainer container = factory.createListenerContainer(endpoint);
|
||||||
|
assertEquals(4, container.getConcurrentConsumers());
|
||||||
|
assertEquals(6, container.getMaxConcurrentConsumers());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
private void setDefaultJmsConfig(AbstractJmsListenerContainerFactory<?> factory) {
|
private void setDefaultJmsConfig(AbstractJmsListenerContainerFactory<?> factory) {
|
||||||
factory.setConnectionFactory(connectionFactory);
|
factory.setConnectionFactory(connectionFactory);
|
||||||
|
|||||||
Reference in New Issue
Block a user