GH-1776 Added support for beanName to DirectWithAttributesChannel

Resolves #1776
This commit is contained in:
Oleg Zhurakousky
2019-08-02 20:29:47 +02:00
parent c6a805539e
commit e8611cf9f7
2 changed files with 6 additions and 17 deletions

View File

@@ -37,4 +37,8 @@ public class DirectWithAttributesChannel extends DirectChannel {
return this.attributes.get(key);
}
@Override
public String getBeanName() {
return this.getComponentName();
}
}

View File

@@ -252,28 +252,13 @@ public class SourceToFunctionsSupportTests {
public static class ExistingMessageSourceConfiguration {
@Bean
public IntegrationFlow messageSourceFlow() {
public IntegrationFlow messageSourceFlow(Source source) {
Supplier<Message<String>> messageSource = () -> MessageBuilder
.withPayload("hello function")
.setHeader(MessageHeaders.CONTENT_TYPE, MimeTypeUtils.TEXT_PLAIN)
.build();
return IntegrationFlows.from(messageSource).channel("output").get();
return IntegrationFlows.from(messageSource).channel(source.output()).get();
}
}
@EnableBinding(Source.class)
public static class ExistingMessageSourceConfigurationNoContentTypeSet {
@Bean
public IntegrationFlow messageSourceFlow() {
Supplier<Message<String>> messageSource = () -> MessageBuilder
.withPayload("hello function")
.setHeader(MessageHeaders.CONTENT_TYPE, "application/octet-stream")
.build();
return IntegrationFlows.from(messageSource).channel("output").get();
}
}
}