I'm currently researching on how I could eventually create a Web App that would be able to monitor Scheduled Jobs that run on a website. It's based on ATG and I've been looking at a lot of OOTB components and I thought I was getting somewhere with it however I really lack knowledge on ATG, as I'm a placement student who's only really been looking at it properly for 1/2 months.
My current thought is to hook my custom code into the performScheduledTask by extending SingletonSchedulableService however all the current scheduled tasks are extending the SingletonSchedulableService and It doesn't sound like a good idea to go into every one (30+) java files and change them? I'm really not sure about that.
The following code is a rough idea of what I would want to happen using the pre-existing performScheduledTask adding my own code into it. When doScheduledTask is called I send a messaging saying it's starting and when it finishes see whether there was an error or not and send a suitable message.
public void performScheduledTask(Scheduler scheduler, ScheduledJob job) {
boolean gotLock = false;
try {
gotLock = acquireLock();
if (gotLock) {
if (isLoggingDebug())
try {
startTime= getJobTime();
sendToStart(name, description, id, startTime);
doScheduledTask(scheduler, job);
} catch (Exception e){
errorMsg= e.getMessage();
}
if (mErrorMessage == null) {
endTime= getJobTime();
String msg= "This job completed successfully";
sendToSuccess(name, description, id, endTime, msg);
} else {
endtime = getJobTime();
sendToFail(name, description, id, endtime, msg);
}
} else if (isLoggingDebug())
logDebug("sleeping until next scheduled wakeup.");
} finally {
if (gotLock)
releaseLock();
}
}
I'm a bit lost at the moment as I've never done a web app completely by myself, let alone hooking it into these scheduled Jobs so any help would be very much appreciated. If you need any extra information, please let me know.
So have you considered using dyn/admin
for this purpose? There is a page which can be accessed http://<your-host-name:<port>/dyn/admin/nucleus/atg/dynamo/service/Scheduler
which has a lot of the information you are looking for.
Also, scheduled components have the Performance Monitor built in which implement the methods startOperation
and endOperation
. Would recommend you look at using these instead of hooking your code into the performScheduledTask()
method. The performance monitor can be enabled/disabled for a property on the scheduled component.
Hope this helps.