spring-framework/framework-docs/modules/ROOT/pages
Simon Baslé 35052f2113 Support `@Scheduled` fixedDelay/fixedRate on Publisher-returning methods
This commit adds support for `@Scheduled` annotation on reactive
methods and Kotlin suspending functions.

Reactive methods are methods that return a `Publisher` or a subclass
of `Publisher`. The `ReactiveAdapterRegistry` is used to support many
implementations, such as `Flux`, `Mono`, `Flow`, `Single`, etc.
Methods should not take any argument and published values will be
ignored, as they are already with synchronous support.

This is implemented in `ScheduledAnnotationReactiveSupport`, which
"converts" Publishers to `Runnable`. This strategy keeps track of
active Subscriptions in the `ScheduledAnnotationBeanPostProcessor`,
in order to cancel them all in case of shutdown.
The existing scheduling support for tasks is reused, aligning the
triggering behavior with the existing support: cron, fixedDelay and
fixedRate are all supported strategies.

If the `Publisher` errors, the exception is logged at warn level and
otherwise ignored. As a result new `Runnable` instances will be
created for each execution and scheduling will continue.
The only difference with synchronous support is that error signals
will not be thrown by those `Runnable` tasks and will not be made
available to the `org.springframework.util.ErrorHandler` contract.
This is due to the asynchronous and lazy nature of Publishers.

Closes gh-23533
Closes gh-28515
2023-06-05 14:13:44 +02:00
..
core Merge branch '6.0.x' 2023-05-15 15:23:16 +02:00
data-access Polish "Fix invalid link in transaction resources" 2023-05-31 12:26:32 +02:00
integration Support `@Scheduled` fixedDelay/fixedRate on Publisher-returning methods 2023-06-05 14:13:44 +02:00
languages Migrate to Asciidoctor Tabs 2023-05-04 15:35:05 +01:00
testing Fix migration to asciidoctor tabs 2023-05-09 12:15:43 +01:00
web Polishing 2023-06-01 14:57:50 +02:00
appendix.adoc Merge branch '6.0.x' (javadoc changes) 2023-05-16 15:05:42 +02:00
attributes.adoc Migrate Structure 2023-05-04 15:35:05 +01:00
core.adoc Remove includes 2023-05-04 15:35:05 +01:00
data-access.adoc Enable Section Summary TOC for small pages 2023-05-04 15:35:05 +01:00
index.adoc Remove PDF Link 2023-05-05 16:56:25 +01:00
integration.adoc Enable Section Summary TOC for small pages 2023-05-04 15:35:05 +01:00
languages.adoc Enable Section Summary TOC for small pages 2023-05-04 15:35:05 +01:00
overview.adoc Remove includes 2023-05-04 15:35:05 +01:00
page-layout.adoc Remove unnecessary asciidoc attributes 2023-05-04 15:35:05 +01:00
rsocket.adoc Merge branch '6.0.x' 2023-05-09 12:16:13 +01:00
testing.adoc Enable Section Summary TOC for small pages 2023-05-04 15:35:05 +01:00
web-reactive.adoc Structural Fixes 2023-05-04 15:35:05 +01:00
web.adoc Enable Section Summary TOC for small pages 2023-05-04 15:35:05 +01:00