use of io.datarouter.web.handler.mav.imp.StringMav in project datarouter by hotpads.
the class JobHandler method run.
@Handler
StringMav run(String name) {
Class<? extends BaseJob> jobClass = BaseJob.parseClass(name);
Date startTime = new Date();
String triggeredBy = getSessionInfo().getRequiredSession().getUsername();
var started = jobScheduler.triggerManualJob(jobClass, triggeredBy);
String message;
if (started.failed()) {
message = "Could not start " + jobClass.getSimpleName() + " reason=" + started.reason();
} else {
Duration elapsedTime = DurationTool.sinceDate(startTime);
message = "Finished manual trigger of " + jobClass.getSimpleName() + " in " + DurationTool.toString(elapsedTime);
changelogRecorder.record(new DatarouterChangelogDtoBuilder("Job", name, "run", getSessionInfo().getRequiredSession().getUsername()).build());
}
logger.warn(message);
return new StringMav(message);
}
Aggregations