Fix for function auto-detection when input/output-bindings are defined
This commit is contained in:
committed by
Oleg Zhurakousky
parent
1e5b41cfee
commit
8d99e80e87
@@ -56,6 +56,28 @@ public class ExplicitBindingTests {
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
void testExplicitBindingsWithExistingFunctionalBean() {
|
||||
try (ConfigurableApplicationContext context = new SpringApplicationBuilder(
|
||||
TestChannelBinderConfiguration.getCompleteConfiguration(ConsumerConfiguration.class))
|
||||
.web(WebApplicationType.NONE)
|
||||
.run("--spring.jmx.enabled=false",
|
||||
"--spring.cloud.stream.input-bindings=test")) {
|
||||
|
||||
assertThat(context.getBean("test", MessageChannel.class)).isNotNull();
|
||||
}
|
||||
|
||||
try (ConfigurableApplicationContext context = new SpringApplicationBuilder(
|
||||
TestChannelBinderConfiguration.getCompleteConfiguration(ConsumerConfiguration.class))
|
||||
.web(WebApplicationType.NONE)
|
||||
.run("--spring.jmx.enabled=false",
|
||||
"--spring.cloud.stream.input-bindings=test;test1")) {
|
||||
|
||||
assertThat(context.getBean("test", MessageChannel.class)).isNotNull();
|
||||
assertThat(context.getBean("test1", MessageChannel.class)).isNotNull();
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
void testExplicitBindingsWithExistingConsumer() {
|
||||
try (ConfigurableApplicationContext context = new SpringApplicationBuilder(
|
||||
|
||||
@@ -120,6 +120,7 @@ import org.springframework.util.StringUtils;
|
||||
* @author Soby Chacko
|
||||
* @author Chris Bono
|
||||
* @author Byungjun You
|
||||
* @author Ivan Shapoval
|
||||
* @since 2.1
|
||||
*/
|
||||
@AutoConfiguration
|
||||
@@ -887,7 +888,7 @@ public class FunctionConfiguration {
|
||||
);
|
||||
for (String inputBindingName : inputBindings) {
|
||||
FunctionInvocationWrapper sourceFunc = functionCatalog.lookup(inputBindingName);
|
||||
if (sourceFunc != null && !sourceFunc.getFunctionDefinition().equals(inputBindingName) && inputBindings.length == 1) {
|
||||
if (sourceFunc != null && !sourceFunc.getFunctionDefinition().equals(inputBindingName)) {
|
||||
sourceFunc = null;
|
||||
}
|
||||
|
||||
@@ -903,7 +904,7 @@ public class FunctionConfiguration {
|
||||
|
||||
for (String outputBindingName : outputBindings) {
|
||||
FunctionInvocationWrapper sourceFunc = functionCatalog.lookup(outputBindingName);
|
||||
if (sourceFunc != null && !sourceFunc.getFunctionDefinition().equals(outputBindingName) && outputBindings.length == 1) {
|
||||
if (sourceFunc != null && !sourceFunc.getFunctionDefinition().equals(outputBindingName)) {
|
||||
sourceFunc = null;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user