diff --git a/pom.xml b/pom.xml
index 8472ffd77..df9b8a7a7 100644
--- a/pom.xml
+++ b/pom.xml
@@ -10,12 +10,12 @@
Pivotal Software, Inc.
http://www.spring.io
-
- org.springframework.boot
- spring-boot-starter-parent
- 1.2.3.RELEASE
-
-
+
+ 1.7
+ 1.2.3.RELEASE
+ 1.0.2.RELEASE
+ 1.2.0.BUILD-SNAPSHOT
+
spring-bus-core
spring-xd-runner
@@ -23,10 +23,17 @@
+
+ org.springframework.boot
+ spring-boot-starter-parent
+ ${spring-boot.version}
+ pom
+ import
+
org.springframework.cloud
spring-cloud-starter-parent
- 1.0.2.RELEASE
+ ${spring-cloud.version}
pom
import
@@ -43,7 +50,7 @@
org.springframework.xd
spring-xd-dirt
- 1.2.0.BUILD-SNAPSHOT
+ ${spring-xd.version}
jackson-core-asl
@@ -102,15 +109,188 @@
org.springframework.xd
spring-xd-messagebus-redis
- 1.2.0.BUILD-SNAPSHOT
+ ${spring-xd.version}
org.springframework.xd
spring-xd-messagebus-rabbit
- 1.2.0.BUILD-SNAPSHOT
+ ${spring-xd.version}
+
+
+
+
+ ${basedir}/src/main/resources
+ true
+
+ **/application.yml
+ **/application.properties
+
+
+
+ ${basedir}/src/main/resources
+
+ **/application.yml
+ **/application.properties
+
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-compiler-plugin
+
+ ${java.version}
+ ${java.version}
+
+
+
+ org.apache.maven.plugins
+ maven-jar-plugin
+
+
+
+ ${start-class}
+ true
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-surefire-plugin
+
+
+ **/*Tests.java
+ **/*Test.java
+
+
+ **/Abstract*.java
+
+
+
+
+ org.apache.maven.plugins
+ maven-war-plugin
+
+ false
+
+
+ ${start-class}
+ true
+
+
+
+
+
+ org.codehaus.mojo
+ exec-maven-plugin
+
+ ${start-class}
+
+
+
+ org.apache.maven.plugins
+ maven-resources-plugin
+ 2.6
+
+
+ ${resource.delimiter}
+
+
+
+
+ pl.project13.maven
+ git-commit-id-plugin
+ 2.1.11
+
+
+
+ revision
+
+
+
+
+ true
+ yyyy-MM-dd'T'HH:mm:ssZ
+ true
+ ${project.build.outputDirectory}/git.properties
+
+
+
+
+ org.springframework.boot
+ spring-boot-maven-plugin
+ ${spring-boot.version}
+
+
+
+ repackage
+
+
+
+
+ ${start-class}
+
+
+
+
+ org.apache.maven.plugins
+ maven-shade-plugin
+
+
+ org.springframework.boot
+ spring-boot-maven-plugin
+ ${spring-boot.version}
+
+
+
+ true
+ true
+
+
+ *:*
+
+ META-INF/*.SF
+ META-INF/*.DSA
+ META-INF/*.RSA
+
+
+
+
+
+
+ package
+
+ shade
+
+
+
+
+ META-INF/spring.handlers
+
+
+ META-INF/spring.factories
+
+
+ META-INF/spring.schemas
+
+
+
+ ${start-class}
+
+
+
+
+
+
+
+
+
spring-snapshots
diff --git a/spring-bus-core/src/main/java/org/springframework/bus/runner/config/MessageBusAdapterConfiguration.java b/spring-bus-core/src/main/java/org/springframework/bus/runner/config/MessageBusAdapterConfiguration.java
index f1531c1e2..12ed8dd73 100644
--- a/spring-bus-core/src/main/java/org/springframework/bus/runner/config/MessageBusAdapterConfiguration.java
+++ b/spring-bus-core/src/main/java/org/springframework/bus/runner/config/MessageBusAdapterConfiguration.java
@@ -31,7 +31,6 @@ import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.ImportResource;
import org.springframework.messaging.MessageChannel;
-import org.springframework.util.StringUtils;
import org.springframework.xd.dirt.integration.bus.MessageBus;
import org.springframework.xd.dirt.integration.bus.MessageBusAwareRouterBeanPostProcessor;
@@ -69,32 +68,11 @@ public class MessageBusAdapterConfiguration {
String[] names = BeanFactoryUtils.beanNamesForTypeIncludingAncestors(beanFactory,
MessageChannel.class);
for (String name : names) {
- OutputChannelSpec channel = null;
- String prefix = "";
- if (name.equals("output")) {
- String channelName = module.getOutputChannelName();
- channel = new OutputChannelSpec(channelName, beanFactory.getBean(name,
- MessageChannel.class));
- }
- else if (name.startsWith("output.")) {
- String channelName = name.substring("output.".length());
- if (channelName.contains(":")) {
- String[] tokens = channelName.split(":", 2);
- String type = tokens[0];
- if ("queue".equals(type)) {
- // omit the type for a queue
- prefix = tokens[1] + ".";
- }
- else {
- prefix = channelName + ".";
- }
- }
- channelName = prefix + getPlainChannelName(module.getOutputChannelName());
- channel = new OutputChannelSpec(channelName, beanFactory.getBean(name,
- MessageChannel.class));
- }
- if (channel != null) {
- String tapChannelName = StringUtils.hasText(prefix) ? module
+ String channelName = extractChannelName("output", name, module.getOutputChannelName());
+ if (channelName != null) {
+ OutputChannelSpec channel = new OutputChannelSpec(channelName,
+ beanFactory.getBean(name, MessageChannel.class));
+ String tapChannelName = !channelName.equals(module.getOutputChannelName()) ? module
.getTapChannelName(getPlainChannelName(channel.getName()))
: module.getTapChannelName();
channel.setTapChannelName(tapChannelName);
@@ -105,6 +83,32 @@ public class MessageBusAdapterConfiguration {
return channels;
}
+ private String extractChannelName(String start, String name, String externalChannelName) {
+ if (name.equals(start)) {
+ return externalChannelName;
+ }
+ else if (name.startsWith(start + ".") || name.startsWith(start + "_")) {
+ String prefix = "";
+ String channelName = name.substring(start.length() + 1);
+ if (channelName.contains(":")) {
+ String[] tokens = channelName.split(":", 2);
+ String type = tokens[0];
+ if ("queue".equals(type)) {
+ // omit the type for a queue
+ prefix = tokens[1] + ".";
+ }
+ else {
+ prefix = channelName + ".";
+ }
+ }
+ else {
+ prefix = channelName + ".";
+ }
+ return prefix + getPlainChannelName(externalChannelName);
+ }
+ return null;
+ }
+
private String getPlainChannelName(String name) {
if (name.contains(":")) {
name = name.substring(name.indexOf(":") + 1);
@@ -117,26 +121,8 @@ public class MessageBusAdapterConfiguration {
String[] names = BeanFactoryUtils.beanNamesForTypeIncludingAncestors(beanFactory,
MessageChannel.class);
for (String name : names) {
- if (name.equals("input")) {
- String channelName = module.getInputChannelName();
- channels.add(new InputChannelSpec(channelName, beanFactory.getBean(name,
- MessageChannel.class)));
- }
- else if (name.startsWith("input.")) {
- String channelName = name.substring("input.".length());
- if (channelName.contains(":")) {
- String[] tokens = channelName.split(":", 2);
- String type = tokens[0];
- if ("queue".equals(type)) {
- // omit the type for a queue
- channelName = tokens[1] + "."
- + getPlainChannelName(module.getInputChannelName());
- }
- else {
- channelName = channelName + "."
- + getPlainChannelName(module.getInputChannelName());
- }
- }
+ String channelName = extractChannelName("input", name, module.getInputChannelName());
+ if (channelName != null) {
channels.add(new InputChannelSpec(channelName, beanFactory.getBean(name,
MessageChannel.class)));
}
diff --git a/spring-bus-core/src/test/java/org/springframework/bus/runner/config/MessageBusAdapterConfigurationTests.java b/spring-bus-core/src/test/java/org/springframework/bus/runner/config/MessageBusAdapterConfigurationTests.java
index 9ac516edb..ceba27562 100644
--- a/spring-bus-core/src/test/java/org/springframework/bus/runner/config/MessageBusAdapterConfigurationTests.java
+++ b/spring-bus-core/src/test/java/org/springframework/bus/runner/config/MessageBusAdapterConfigurationTests.java
@@ -107,6 +107,22 @@ public class MessageBusAdapterConfigurationTests {
assertEquals("tap:stream:foo.bar.module.0", channels.iterator().next().getTapChannelName());
}
+ @Test
+ public void noQueueQualifier() throws Exception {
+ context.registerSingleton("output.foo", new DirectChannel());
+ Collection channels = configuration.getOutputChannels();
+ assertEquals(1, channels.size());
+ assertEquals("foo.group.0", channels.iterator().next().getName());
+ }
+
+ @Test
+ public void underscoreSeparatorForChannelName() throws Exception {
+ context.registerSingleton("output_foo", new DirectChannel());
+ Collection channels = configuration.getOutputChannels();
+ assertEquals(1, channels.size());
+ assertEquals("foo.group.0", channels.iterator().next().getName());
+ }
+
@Test
public void overrideNaturalOutputChannelNamedQueue() throws Exception {
module.setOutputChannelName("queue:bar");