Skip to content
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

Commits on May 5, 2023

  1. Support @Scheduled fixedDelay/fixedRate on Publisher-returning methods

    This 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
    simonbasle committed May 5, 2023
    Configuration menu
    Copy the full SHA
    9d5831a View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    f5b03c5 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    3c11661 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    139f946 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    2528ee3 View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    3a9c6e2 View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    837b76c View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    5d62e18 View commit details
    Browse the repository at this point in the history
  9. 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.
    simonbasle committed May 5, 2023
    Configuration menu
    Copy the full SHA
    c90595e View commit details
    Browse the repository at this point in the history
  10. polish javadocs

    simonbasle committed May 5, 2023
    Configuration menu
    Copy the full SHA
    af9c88c View commit details
    Browse the repository at this point in the history
  11. Configuration menu
    Copy the full SHA
    cfdc59b View commit details
    Browse the repository at this point in the history
  12. Configuration menu
    Copy the full SHA
    4905576 View commit details
    Browse the repository at this point in the history
  13. polish: remove FIXME

    simonbasle committed May 5, 2023
    Configuration menu
    Copy the full SHA
    37c1cfa View commit details
    Browse the repository at this point in the history
  14. polish indentation

    simonbasle committed May 5, 2023
    Configuration menu
    Copy the full SHA
    ffdbc27 View commit details
    Browse the repository at this point in the history
  15. Configuration menu
    Copy the full SHA
    a413f4f View commit details
    Browse the repository at this point in the history
  16. polish and fix tests

    simonbasle committed May 5, 2023
    Configuration menu
    Copy the full SHA
    78a47c9 View commit details
    Browse the repository at this point in the history
  17. Configuration menu
    Copy the full SHA
    1f87111 View commit details
    Browse the repository at this point in the history
  18. polish javadoc and fixmes

    simonbasle committed May 5, 2023
    Configuration menu
    Copy the full SHA
    5b3ae76 View commit details
    Browse the repository at this point in the history

Commits on May 15, 2023

  1. Configuration menu
    Copy the full SHA
    ae3f208 View commit details
    Browse the repository at this point in the history