Hi all,
My users would like to setup jobs that will run at specific times of the month (e.g. every 10th, and 20th of the month), and my initial reaction was to look at ofbiz's own JobManager/JobSandbox. From the data model, specifically Recurrence_Rule table, this looks supported by ofbiz, so I created a little test case for it. Below is a list of entity definition that theoretically will execute a job to print "Hello world" every other minute: ------------------------------------------------------------------ <?xml version="1.0" encoding="UTF-8"?> <entity-engine-xml> <RecurrenceRule recurrenceRuleId="20000" untilDateTime="2008-06-19 00:00:00.000" frequency="MINUTELY" intervalNumber="1" byMinuteList="42,44,46,48,50,52,54,56,58,0,2,4,6,8,10,12,14,16,18,20,22,24,26,28,30,32,34,36,38,40" countNumber="-1"/> <RecurrenceInfo recurrenceInfoId="20000" startDateTime="2007-06-19 00:00:00.000" recurrenceRuleId="20000" recurrenceCount="0"/> <RuntimeData runtimeDataId="20000"> <runtimeInfo><![CDATA[<?xml version="1.0" encoding="UTF-8"?> <ofbiz-ser> <map-HashMap> <map-Entry> <map-Key> <std-String value="testString"/> </map-Key> <map-Value> <std-String value="hello world"/> </map-Value> </map-Entry> </map-HashMap> </ofbiz-ser> ]]></runtimeInfo> </RuntimeData> <JobSandbox jobId="20000" jobName="test job" runTime="2007-06-19 00:00:00.000" serviceName="printSomething" runtimeDataId="20000" poolId="pool" runAsUser="system" recurrenceInfoId="20000"/> </entity-engine-xml> -------------------------------------------------------------------- I've tried running this job and it doesn't get executed even once. Looking through the code, I spotted these two lines in RecurrenceRule.java: Line 137: byMinuteList = StringUtil.split(rule.getString("byMinuteList"), ","); Line 397: if (!byMinuteList.contains(new Integer(cal.get(Calendar.MINUTE)))) The 2nd line will always return false since the list contains String objects and Integer objects. Is this a bug in RecurrenceRule? or more likely, am I missing something here? Thanks for all your assistances! wan |
Sorry for the double post -- should have been more careful before hitting that Send button. Correction on what I said is wrong about this conditional: "if (!byMinuteList.contains(new Integer(cal.get(Calendar.MINUTE)))) " The comparison will always return true since the list contains String objects and we're looking for Integer objects. The end result is scheduler is not able to find the nextRuntime for that particular job and it's never run. thanks, wan Wan Agus wrote: > Hi all, > > My users would like to setup jobs that will run at specific times of > the month (e.g. every 10th, and 20th of the month), and my initial > reaction was to look at ofbiz's own JobManager/JobSandbox. From the > data model, specifically Recurrence_Rule table, this looks supported > by ofbiz, so I created a little test case for it. > > Below is a list of entity definition that theoretically will execute a > job to print "Hello world" every other minute: > > > ------------------------------------------------------------------ > <?xml version="1.0" encoding="UTF-8"?> > <entity-engine-xml> > > <RecurrenceRule recurrenceRuleId="20000" untilDateTime="2008-06-19 > 00:00:00.000" frequency="MINUTELY" intervalNumber="1" > byMinuteList="42,44,46,48,50,52,54,56,58,0,2,4,6,8,10,12,14,16,18,20,22,24,26,28,30,32,34,36,38,40" > countNumber="-1"/> > > <RecurrenceInfo recurrenceInfoId="20000" startDateTime="2007-06-19 > 00:00:00.000" recurrenceRuleId="20000" recurrenceCount="0"/> > > <RuntimeData runtimeDataId="20000"> > <runtimeInfo><![CDATA[<?xml version="1.0" encoding="UTF-8"?> > <ofbiz-ser> > <map-HashMap> > <map-Entry> > <map-Key> > <std-String value="testString"/> > </map-Key> > <map-Value> > <std-String value="hello world"/> > </map-Value> > </map-Entry> > </map-HashMap> > </ofbiz-ser> > ]]></runtimeInfo> > </RuntimeData> > > <JobSandbox jobId="20000" jobName="test job" runTime="2007-06-19 > 00:00:00.000" serviceName="printSomething" runtimeDataId="20000" > poolId="pool" runAsUser="system" recurrenceInfoId="20000"/> > > </entity-engine-xml> > -------------------------------------------------------------------- > > I've tried running this job and it doesn't get executed even once. > Looking through the code, I spotted these two lines in > RecurrenceRule.java: > > Line 137: > byMinuteList = StringUtil.split(rule.getString("byMinuteList"), ","); > > > Line 397: > if (!byMinuteList.contains(new Integer(cal.get(Calendar.MINUTE)))) > > > The 2nd line will always return false since the list contains String > objects and Integer objects. > > Is this a bug in RecurrenceRule? or more likely, am I missing > something here? > Thanks for all your assistances! > > wan > > > > > ------------------------------------------------------------------------ > > No virus found in this incoming message. > Checked by AVG Free Edition. > Version: 7.5.472 / Virus Database: 269.9.1/854 - Release Date: 6/19/2007 1:12 PM > |
Administrator
|
Wan,
Did you investigate more in this ? If you are sure there is a problem, feel free to open a Jira issue Jacques De : "Wan Agus" <[hidden email]> > > Sorry for the double post -- should have been more careful before > hitting that Send button. > > Correction on what I said is wrong about this conditional: > > "if (!byMinuteList.contains(new Integer(cal.get(Calendar.MINUTE)))) " > > The comparison will always return true since the list contains String > objects and we're looking for Integer objects. The end result is > scheduler is not able to find the nextRuntime for that particular job > and it's never run. > > thanks, > wan > > > Wan Agus wrote: > > Hi all, > > > > My users would like to setup jobs that will run at specific times of > > the month (e.g. every 10th, and 20th of the month), and my initial > > reaction was to look at ofbiz's own JobManager/JobSandbox. From the > > data model, specifically Recurrence_Rule table, this looks supported > > by ofbiz, so I created a little test case for it. > > > > Below is a list of entity definition that theoretically will execute a > > job to print "Hello world" every other minute: > > > > > > ------------------------------------------------------------------ > > <?xml version="1.0" encoding="UTF-8"?> > > <entity-engine-xml> > > > > <RecurrenceRule recurrenceRuleId="20000" untilDateTime="2008-06-19 > > 00:00:00.000" frequency="MINUTELY" intervalNumber="1" > > byMinuteList="42,44,46,48,50,52,54,56,58,0,2,4,6,8,10,12,14,16,18,20,22,24,26,28,30,32,34,36,38,40" > > countNumber="-1"/> > > > > <RecurrenceInfo recurrenceInfoId="20000" startDateTime="2007-06-19 > > 00:00:00.000" recurrenceRuleId="20000" recurrenceCount="0"/> > > > > <RuntimeData runtimeDataId="20000"> > > <runtimeInfo><![CDATA[<?xml version="1.0" encoding="UTF-8"?> > > <ofbiz-ser> > > <map-HashMap> > > <map-Entry> > > <map-Key> > > <std-String value="testString"/> > > </map-Key> > > <map-Value> > > <std-String value="hello world"/> > > </map-Value> > > </map-Entry> > > </map-HashMap> > > </ofbiz-ser> > > ]]></runtimeInfo> > > </RuntimeData> > > > > <JobSandbox jobId="20000" jobName="test job" runTime="2007-06-19 > > 00:00:00.000" serviceName="printSomething" runtimeDataId="20000" > > poolId="pool" runAsUser="system" recurrenceInfoId="20000"/> > > > > </entity-engine-xml> > > -------------------------------------------------------------------- > > > > I've tried running this job and it doesn't get executed even once. > > Looking through the code, I spotted these two lines in > > RecurrenceRule.java: > > > > Line 137: > > byMinuteList = StringUtil.split(rule.getString("byMinuteList"), ","); > > > > > > Line 397: > > if (!byMinuteList.contains(new Integer(cal.get(Calendar.MINUTE)))) > > > > > > The 2nd line will always return false since the list contains String > > objects and Integer objects. > > > > Is this a bug in RecurrenceRule? or more likely, am I missing > > something here? > > Thanks for all your assistances! > > > > wan > > > > > > > > > > ------------------------------------------------------------------------ > > > > No virus found in this incoming message. > > Checked by AVG Free Edition. > > Version: 7.5.472 / Virus Database: 269.9.1/854 - Release Date: 6/19/2007 1:12 PM > > > |
Free forum by Nabble | Edit this page |