GH-1956 Add support for PollableSource in functional programing model
This feature effectively provides identical path to create PollableSource as it was in annotation-based programming model. However, unlike creating and providing binding intreface all that is required from user is 'spring.cloud.stream.pollable-source' property Resolves #1956
This commit is contained in:
@@ -1242,21 +1242,18 @@ support.
|
||||
===== Overview
|
||||
|
||||
When using polled consumers, you poll the `PollableMessageSource` on demand.
|
||||
Consider the following example of a polled consumer:
|
||||
To define binding for polled consumer you need to provide `spring.cloud.stream.pollable-source` property.
|
||||
|
||||
[source,java]
|
||||
Consider the following example of a polled consumer binding:
|
||||
|
||||
[source,text]
|
||||
----
|
||||
public interface PolledConsumer {
|
||||
|
||||
@Input
|
||||
PollableMessageSource destIn();
|
||||
|
||||
@Output
|
||||
MessageChannel destOut();
|
||||
|
||||
}
|
||||
--spring.cloud.stream.pollable-source=myDestination
|
||||
----
|
||||
|
||||
The pollable-source name `myDestination` in the preceding example will result in `myDestination-in-0` binding name to stay
|
||||
consistent with functional programming model.
|
||||
|
||||
Given the polled consumer in the preceding example, you might use it as follows:
|
||||
|
||||
[source,java]
|
||||
@@ -1348,6 +1345,7 @@ boolean result = pollableSource.poll(received -> {
|
||||
}, new ParameterizedTypeReference<Map<String, Foo>>() {});
|
||||
----
|
||||
|
||||
|
||||
[[polled-errors]]
|
||||
===== Handling Errors
|
||||
|
||||
|
||||
Reference in New Issue
Block a user