Hi,
This is the sample code for custom job using java.
myBackgroundJob .java
-----------------------------------
package com.myserver.jobs.background;
import com.niku.union.interfaces.JobSchedulerContext;
import com.niku.union.interfaces.SchedulerListener;
public class myBackgroundJob implements SchedulerListener {
public myBackgroundJob() {
}
public void scheduledEventFired(JobSchedulerContext jobContext_)
throws Exception {
if (jobContext_ == null) {
throw new Exception("Invalid JobContext");
}
try {
testJob(jobContext_);
} catch (Exception e) {
throw new Exception("Cannot doSomeWork()::" + e);
}
}
private void testJob(JobSchedulerContext context) throws Exception
{
String firstname=context.getSecurityIdentifier().getFirstName();
context.getJob().logMessage("JOB ID"+context.getJob().getId());
context.getJob().logWarning("Session ID"+context.getSecurityIdentifier().getSessionId());
}
}
jar the above java class (include your requirement in testJob() method )and deploy it in clarity/lib folder. create job of type Java and give Executable name as fully qualified
path "com.myserver.jobs.background.myBackgroundJob". restart the bg once.
Now Java Job ready to run.