Add auto-startup support for JmsListenerContainerFactory

The auto startup flag can now be set on a JmsListenerContainerFactory to
control if the created container should be started automatically when the
application context starts.

Issue: SPR-12824
This commit is contained in:
Stephane Nicoll
2015-04-07 11:32:16 +02:00
parent b6449baaa6
commit 6f3570a0f6
2 changed files with 14 additions and 1 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2014 the original author or authors.
* Copyright 2002-2015 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -60,6 +60,8 @@ public abstract class AbstractJmsListenerContainerFactory<C extends AbstractMess
private Integer phase;
private Boolean autoStartup;
/**
* @see AbstractMessageListenerContainer#setConnectionFactory(ConnectionFactory)
@@ -138,6 +140,12 @@ public abstract class AbstractJmsListenerContainerFactory<C extends AbstractMess
this.phase = phase;
}
/**
* @see AbstractMessageListenerContainer#setAutoStartup(boolean)
*/
public void setAutoStartup(boolean autoStartup) {
this.autoStartup = autoStartup;
}
@Override
public C createListenerContainer(JmsListenerEndpoint endpoint) {
@@ -176,6 +184,9 @@ public abstract class AbstractJmsListenerContainerFactory<C extends AbstractMess
if (this.phase != null) {
instance.setPhase(this.phase);
}
if (this.autoStartup != null) {
instance.setAutoStartup(this.autoStartup);
}
endpoint.setupListenerContainer(instance);
initializeContainer(instance);