diff --git a/docs/src/main/asciidoc/spring-cloud-stream.adoc b/docs/src/main/asciidoc/spring-cloud-stream.adoc index 74021c2d2..26ab7f904 100644 --- a/docs/src/main/asciidoc/spring-cloud-stream.adoc +++ b/docs/src/main/asciidoc/spring-cloud-stream.adoc @@ -726,6 +726,20 @@ public ApplicationRunner poller(PollableMessageSource destIn, MessageChannel des } ---- +A less manual and more Spring-like alternative would be to configure a scheduled task bean. For example, + +[source,java] +---- + +@Scheduled(fixedDelay = 5_000) +public void poll() { + System.out.println("Polling..."); + this.source.poll(m -> { + System.out.println(m.getPayload()); + + }, new ParameterizedTypeReference() { }); +} +---- The `PollableMessageSource.poll()` method takes a `MessageHandler` argument (often a lambda expression, as shown here). It returns `true` if the message was received and successfully processed. diff --git a/pom.xml b/pom.xml index 319e5700f..70c77a88b 100644 --- a/pom.xml +++ b/pom.xml @@ -28,7 +28,7 @@ Californium-RELEASE 3.0.3 2.1 - 2.0.1.RELEASE + 2.0.2.BUILD-SNAPSHOT true