Skip to content

Improve toString for reactive ScheduledTask #34010

@slaha

Description

@slaha

Hello,

There were some improvements in the actuator/scheduledtasks endpoint in SpringBoot 3.4 which are great but when the task is reactive (kotlin suspend function in my case but I think the same applies for reactor types), the task is wrapped in SubscribingRunnable and therefore the name of the task (in runnable.target) does not show the actual name of the task:

{
    "runnable": {
        "target": "org.springframework.scheduling.annotation.ScheduledAnnotationReactiveSupport$SubscribingRunnable@62658650"
    },
    "initialDelay": 1067,
    "interval": 120000,
    "nextExecution": {
        "time": "2024-12-02T20:26:46.714560Z"
    },
    "lastExecution": {
        "time": "2024-12-02T20:24:46.666944Z",
        "status": "SUCCESS"
    }
}

I checked the sources and it does not seem there is an easy way how to change the value. The SubscribingRunnable.toString is used. My suggestion is to override the toString method in SubscribingRunnable to show coordinates of the actual task method.

So TLDR:
Problem: Name of scheduled task in actuator/scheduledtasks is useless when task is wrapped in SubscribingRunnable
Desired state: The name is taken from the actual task class/method, not SubscribingRunnable.

SpringBoot version: 3.4.0

Metadata

Metadata

Assignees

Labels

in: coreIssues in core modules (aop, beans, core, context, expression)type: enhancementA general enhancement

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions