How to run service some time after another service?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

How to run service some time after another service?

Trenton Perceval
Hi.
I have a question.
I want to run some service written by me 14 days after the project (in projectmgr) was closed. How to do it?
I know that there is some scheduler in OFBiz, but I don't have idea how to use it.
Could you give me any advice?

Trenton
Reply | Threaded
Open this post in threaded view
|

Re: How to run service some time after another service?

Mohd Viqar
This post was updated on .
Here is an example



<now-timestamp field="currentTime"/>

<set-calendar field="jobRuntTime" days="14" from-field="currentTime"/>

<log level="info" message="current time is : ${currentTime} and job will run at : ${jobRuntTime}" />
<make-value value-field="JobSandbox" entity-name="JobSandbox"/>

<sequenced-id sequence-name="JobSandbox" field="jobSandbox.jobId"/>

<set field="JobSandbox.jobName" value="My Service will run after 14 days" />

<set field="JobSandbox.runTime" from-field="jobRuntTime" type="Timestamp"/>

<set field="JobSandbox.poolId" value="pool" />

<set field="JobSandbox.statusId" value="SERVICE_PENDING" />

<set field="JobSandbox.serviceName" value="serviceNameToExecute" /> 

<set field="JobSandbox.runAsUser" value="system" />

<log level="info" message=" - JobSandbox - [${JobSandbox}]"></log>
<check-errors />

<create-value value-field="JobSandbox" or-store="true"/>

Regards
Mohd Viqar
Reply | Threaded
Open this post in threaded view
|

Re: How to run service some time after another service?

Scott Gray-2
That is not a valid example, you should never modify the JobSandbox directly.  Use dispatcher.schedule(...)

Regards
Scott

On 9/01/2013, at 6:21 AM, mohd Viqar wrote:

> Here is an example
>
>
>
> <now-timestamp field="currentTime"/>
>
> <set-calendar field="jobruntime" days="14" from-field="currentTime"/>
>
> <log level="info" message="current time is : ${currentTime} and job will run
> at : ${jobRuntTime}" />
> <make-value value-field="JobSandbox" entity-name="JobSandbox"/>
>
> <sequenced-id sequence-name="JobSandbox" field="jobSandbox.jobId"/>
>
> <set field="JobSandbox.jobName" value="My Service will run after 14 days" />
>
> <set field="JobSandbox.runTime" from-field="jobRuntTime" type="Timestamp"/>
>
> <set field="JobSandbox.poolId" value="pool" />
>
> <set field="JobSandbox.statusId" value="SERVICE_PENDING" />
>
> <set field="JobSandbox.serviceName" value="serviceNameToExecute" />
>
> <set field="JobSandbox.runAsUser" value="system" />
>
> <log level="info" message=" - JobSandbox - [${JobSandbox}]"></log>
> <check-errors />
>
> <create-value value-field="JobSandbox" or-store="true"/>
>
> Regards
> Mohd Viqar
>
>
>
> --
> View this message in context: http://ofbiz.135035.n4.nabble.com/How-to-run-service-some-time-after-another-service-tp4638744p4638763.html
> Sent from the OFBiz - User mailing list archive at Nabble.com.