question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Overview of @Scheduled methods (spring-boot-actuator)

See original GitHub issue

We use @Scheduled annotation to schedule some tasks. But they are hidden at runtime and can be forgotten easily. It would be very nice to have an overview of all scheduled jobs and their cron values.

If spring-boot-actuator can provide an endpoint listing all scheduled methods we can monitor them via tools like spring-boot-admin (https://github.com/codecentric/spring-boot-admin/issues/432)

Thanks.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:3
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

7reactions
wilkinsonacommented, Nov 15, 2017

Here’s an example of the response from the new scheduledtasks endpoint:

HTTP/1.1 200 OK
Content-Type: application/vnd.spring-boot.actuator.v2+json;charset=UTF-8
Date: Wed, 15 Nov 2017 10:58:10 GMT
Transfer-Encoding: chunked

{
    "cron": [
        {
            "expression": "0 0 0/6 1/1 * ?",
            "runnable": {
                "target": "com.example.demo.MvcActuatorApplication.someCronTask"
            }
        },
        {
            "expression": "0 0 0/3 1/1 * ?",
            "runnable": {
                "target": "com.example.demo.MvcActuatorApplication$CronTriggeredRunnable"
            }
        }
    ],
    "fixedDelay": [
        {
            "initialDelay": 23,
            "interval": 12,
            "runnable": {
                "target": "com.example.demo.MvcActuatorApplication.someFixedDelayTask"
            }
        },
        {
            "initialDelay": 100,
            "interval": 100,
            "runnable": {
                "target": "com.example.demo.MvcActuatorApplication$FixedDelayRunnable"
            }
        }
    ],
    "fixedRate": [
        {
            "initialDelay": 67,
            "interval": 45,
            "runnable": {
                "target": "com.example.demo.MvcActuatorApplication.someFixedRateTask"
            }
        },
        {
            "initialDelay": 200,
            "interval": 200,
            "runnable": {
                "target": "com.example.demo.MvcActuatorApplication$FixedRateRunnable"
            }
        }
    ]
}
0reactions
kamaydeocommented, Jan 19, 2020

Thanks. That worked. @Scheduled shows the method name in the /actuator/scheduledtasks. It would be great if ScheduledTaskRegistrar provided a way to specify the name of the scheduled task. When I used lambda with ScheduledTaskRegistrar, /actuator/scheduledtasks shows name of the lambda which is kinda not useful.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Production-ready Features - Spring
The spring-boot-actuator module provides all of Spring Boot's production-ready ... ID, Description ... Displays the scheduled tasks in your application.
Read more >
Spring Boot Actuator | Baeldung
A quick intro to Spring Boot Actuators - using and extending the existing ... /scheduledtasks provides details about every scheduled task ...
Read more >
Running Scheduled Jobs in Spring Boot - Reflectoring
After enabling scheduling, we will add jobs to our application for scheduling. We can turn any method in a Spring bean for scheduling...
Read more >
Spring Boot - Scheduling - Tutorialspoint
The @Scheduled annotation is used to trigger the scheduler for a specific time period. @Scheduled(cron = "0 * 9 * * ?") ...
Read more >
Scheduling in Spring Boot - Spring Framework Guru
We use scheduling to schedule jobs in a Spring Boot application. For instance, you can implement scheduling to perform some task at a...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found