|
|
This post has NOT been accepted by the mailing list yet.
Hi peeps, I got this quartz stateful job executed every second. Seems the mergedJobDataMap got reset for some reason that it doesn't retain the input to the map.
I have spent a whole day to sort this out. Anyone can help?
// this is the output
jobDataMap=org.quartz.JobDataMap@fb19573b
jobDataMap.mykey=null
jobDataMap.mykey=thisismykey
jobDataMap=org.quartz.JobDataMap@fb19573b
jobDataMap.mykey=null
jobDataMap.mykey=thisismykey
// code
public class QuartzRouteBuilder extends RouteBuilder{
@Override
public void configure() throws Exception {
from("quartz://myGroup/myTimerName?cron=0/1 * * * * %3F&stateful=true").process(new MyProcessor());
}
private class MyProcessor implements Processor{
@Override
public void process(Exchange exchange) throws Exception {
// TODO Auto-generated method stub
JobDataMap jobDataMap = exchange.getIn().getHeader(
"mergedJobDataMap", JobDataMap.class);
System.out.println("jobDataMap="+jobDataMap);
System.out.println("jobDataMap.mykey="+jobDataMap.get("mykey"));
jobDataMap.put("mykey", "thisismykey");
System.out.println("jobDataMap.mykey="+jobDataMap.get("mykey"));
}
}
}
|