Removed support for 'auto-create-channels' on the MessageBus. All channels must be explicitly created and registered with the bus (INT-247).
This commit is contained in:
@@ -96,8 +96,6 @@ public class DefaultMessageBus implements MessageBus, ApplicationContextAware, A
|
||||
|
||||
private volatile boolean configureAsyncEventMulticaster = false;
|
||||
|
||||
private volatile boolean autoCreateChannels = false;
|
||||
|
||||
private volatile boolean autoStartup = true;
|
||||
|
||||
private volatile boolean initialized;
|
||||
@@ -146,14 +144,6 @@ public class DefaultMessageBus implements MessageBus, ApplicationContextAware, A
|
||||
this.autoStartup = autoStartup;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set whether the bus should automatically create a channel when a
|
||||
* subscription contains the name of a previously unregistered channel.
|
||||
*/
|
||||
public void setAutoCreateChannels(boolean autoCreateChannels) {
|
||||
this.autoCreateChannels = autoCreateChannels;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set whether the bus should configure its asynchronous task executor
|
||||
* to also be used by the ApplicationContext's 'applicationEventMulticaster'.
|
||||
@@ -297,15 +287,25 @@ public class DefaultMessageBus implements MessageBus, ApplicationContextAware, A
|
||||
}
|
||||
MessageTarget target = endpoint.getTarget();
|
||||
if (target == null) {
|
||||
target = this.lookupOrCreateChannel(endpoint.getOutputChannelName());
|
||||
if (target != null) {
|
||||
String outputChannelName = endpoint.getOutputChannelName();
|
||||
if (outputChannelName != null) {
|
||||
target = this.lookupChannel(outputChannelName);
|
||||
if (target == null) {
|
||||
throw new ConfigurationException("cannot activate endpoint '" + endpoint +
|
||||
"', unable to resolve output-channel '" + outputChannelName + "'");
|
||||
}
|
||||
endpoint.setTarget(target);
|
||||
}
|
||||
}
|
||||
MessageSource<?> source = endpoint.getSource();
|
||||
if (source == null) {
|
||||
source = this.lookupOrCreateChannel(endpoint.getInputChannelName());
|
||||
if (source != null) {
|
||||
String inputChannelName = endpoint.getInputChannelName();
|
||||
if (inputChannelName != null) {
|
||||
source = this.lookupChannel(inputChannelName);
|
||||
if (source == null) {
|
||||
throw new ConfigurationException("cannot activate endpoint '" + endpoint +
|
||||
"', unable to resolve input-channel '" + inputChannelName + "'");
|
||||
}
|
||||
endpoint.setSource(source);
|
||||
}
|
||||
}
|
||||
@@ -332,25 +332,6 @@ public class DefaultMessageBus implements MessageBus, ApplicationContextAware, A
|
||||
}
|
||||
}
|
||||
|
||||
private MessageChannel lookupOrCreateChannel(String channelName) {
|
||||
if (channelName == null) {
|
||||
return null;
|
||||
}
|
||||
MessageChannel channel = this.lookupChannel(channelName);
|
||||
if (channel == null) {
|
||||
if (!this.autoCreateChannels) {
|
||||
throw new ConfigurationException("Cannot activate endpoint, unknown channel '" + channelName
|
||||
+ "'. Consider enabling the 'autoCreateChannels' option for the message bus.");
|
||||
}
|
||||
if (this.logger.isInfoEnabled()) {
|
||||
logger.info("auto-creating channel '" + channelName + "'");
|
||||
}
|
||||
channel = channelFactory.getChannel(channelName, null);
|
||||
this.registerChannel(channel);
|
||||
}
|
||||
return channel;
|
||||
}
|
||||
|
||||
private void registerGateway(String name, MessagingGateway gateway) {
|
||||
if (gateway instanceof Lifecycle) {
|
||||
this.lifecycleEndpoints.add((Lifecycle) gateway);
|
||||
|
||||
@@ -32,7 +32,6 @@
|
||||
</xsd:element>
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="auto-startup" type="xsd:boolean"/>
|
||||
<xsd:attribute name="auto-create-channels" type="xsd:boolean"/>
|
||||
<xsd:attribute name="channel-factory" type="xsd:string"/>
|
||||
<xsd:attribute name="dispatcher-pool-size" type="xsd:int"/>
|
||||
<xsd:attribute name="configure-async-event-multicaster" type="xsd:boolean"/>
|
||||
|
||||
Reference in New Issue
Block a user