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
Comment From: lucky8987
@bclozel Can this issue be assigned to me? I can submit a PR to fix it.
@Override
public String toString() {
Method method = contextSupplier.get().getMethod();
return method.getDeclaringClass().getName() + "." + method.getName();
}
Comment From: bclozel
Thanks for the proposal but it's already assigned.