INT-4330: Add support for Supplier MessageSource

JIRA: https://jira.spring.io/browse/INT-4330

- updated documentation
- updated test
This commit is contained in:
Oleg Zhurakousky
2017-08-17 12:01:03 -04:00
committed by Artem Bilan
parent ab9e843cfa
commit 946cc229eb
3 changed files with 53 additions and 12 deletions

View File

@@ -569,6 +569,26 @@ public class MyFlowConfiguration {
}
----
Starting with _version 5.0_, support is also provided for `@Bean` annotated `InboundChannelAdapter`s that return `java.util.function.Supplier` which can produce either a POJO or a `Message`:
[source,java]
----
@Configuration
@EnableIntegration
public class MyFlowConfiguration {
@Bean
@InboundChannelAdapter(value = "inputChannel", poller = @Poller(fixedDelay = "1000"))
public Supplier<String> pojoSupplier() {
return () -> "foo";
}
@Bean
@InboundChannelAdapter(value = "inputChannel", poller = @Poller(fixedDelay = "1000"))
public Supplier<Message<String>> messageSupplier() {
return () -> new GenericMessage<>("foo");
}
----
The meta-annotation rules work on `@Bean` methods as well (`@MyServiceActivator` above can be applied to a `@Bean` definition).
NOTE: When using these annotations on consumer `@Bean` definitions, if the bean definition returns an appropriate