-
Notifications
You must be signed in to change notification settings - Fork 37.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support @Scheduled
on Reactive methods and Kotlin suspending functions
#29924
Closed
simonbasle
wants to merge
19
commits into
spring-projects:main
from
simonbasle:23533-scheduledForPublishers
Closed
Support @Scheduled
on Reactive methods and Kotlin suspending functions
#29924
simonbasle
wants to merge
19
commits into
spring-projects:main
from
simonbasle:23533-scheduledForPublishers
Commits on May 5, 2023
-
Support
@Scheduled
fixedDelay/fixedRate on Publisher-returning methodsThis commit adds support for `@Scheduled` annotation on reactive methods in fixed delay or fixed rate mode. Cron mode is not supported. Reactive methods are methods that return a Publisher or a subclass of Publisher. This is only considered if Reactor (and Reactive Streams) is present at runtime. This is implemented using Reactor operators, as a `Flux<Void>` that repeatedly flatmaps to the `Publisher` in the background, re-subscribing to it according to the `@Scheduled` configuration. The method which creates the `Publisher` is only called once. If the `Publisher` errors, the exception is logged at warn level and otherwise ignored. As a result the underlying `Flux` will continue re-subscribing to the `Publisher`. Note that if Reactor is not present, the standard processing applies and the method itself will repeatedly be scheduled for execution, ignoring the returned `Publisher` and not even subscribing to it. This effectively becomes a no-op operation unless the method has other side effects. Closes spring-projectsgh-23533
Configuration menu - View commit details
-
Copy full SHA for 9d5831a - Browse repository at this point
Copy the full SHA 9d5831aView commit details -
Configuration menu - View commit details
-
Copy full SHA for f5b03c5 - Browse repository at this point
Copy the full SHA f5b03c5View commit details -
Configuration menu - View commit details
-
Copy full SHA for 3c11661 - Browse repository at this point
Copy the full SHA 3c11661View commit details -
Configuration menu - View commit details
-
Copy full SHA for 139f946 - Browse repository at this point
Copy the full SHA 139f946View commit details -
Configuration menu - View commit details
-
Copy full SHA for 2528ee3 - Browse repository at this point
Copy the full SHA 2528ee3View commit details -
Configuration menu - View commit details
-
Copy full SHA for 3a9c6e2 - Browse repository at this point
Copy the full SHA 3a9c6e2View commit details -
Configuration menu - View commit details
-
Copy full SHA for 837b76c - Browse repository at this point
Copy the full SHA 837b76cView commit details -
Configuration menu - View commit details
-
Copy full SHA for 5d62e18 - Browse repository at this point
Copy the full SHA 5d62e18View commit details -
Polish: use a single check for reactive and kotlin methods
The support's `isReactive` method checks Kotlin suspending functions first then reactive (Publisher-returning) methods second. It asserts the relevant runtime, all in a single call. Similarly, turning the Method into a Publisher is done via a single common helper method `getPublisherFor(Method, Object)`. All imports of reactive classes and other reactive-specific logic is still outsourced to ScheduledAnnotationReactiveSupport in order to avoid any classpath issue in the bean postprocessor.
Configuration menu - View commit details
-
Copy full SHA for c90595e - Browse repository at this point
Copy the full SHA c90595eView commit details -
Configuration menu - View commit details
-
Copy full SHA for af9c88c - Browse repository at this point
Copy the full SHA af9c88cView commit details -
Configuration menu - View commit details
-
Copy full SHA for cfdc59b - Browse repository at this point
Copy the full SHA cfdc59bView commit details -
Configuration menu - View commit details
-
Copy full SHA for 4905576 - Browse repository at this point
Copy the full SHA 4905576View commit details -
Configuration menu - View commit details
-
Copy full SHA for 37c1cfa - Browse repository at this point
Copy the full SHA 37c1cfaView commit details -
Configuration menu - View commit details
-
Copy full SHA for ffdbc27 - Browse repository at this point
Copy the full SHA ffdbc27View commit details -
Configuration menu - View commit details
-
Copy full SHA for a413f4f - Browse repository at this point
Copy the full SHA a413f4fView commit details -
Configuration menu - View commit details
-
Copy full SHA for 78a47c9 - Browse repository at this point
Copy the full SHA 78a47c9View commit details -
Configuration menu - View commit details
-
Copy full SHA for 1f87111 - Browse repository at this point
Copy the full SHA 1f87111View commit details -
Configuration menu - View commit details
-
Copy full SHA for 5b3ae76 - Browse repository at this point
Copy the full SHA 5b3ae76View commit details
Commits on May 15, 2023
-
Configuration menu - View commit details
-
Copy full SHA for ae3f208 - Browse repository at this point
Copy the full SHA ae3f208View commit details
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.