Comments? Questions? Get Involved? Join the Forum
Moqui provide support to configure ad-hoc (explicitly executed) or schedule jobs using moqui.service.job.ServiceJob
and moqui.service.job.ServiceJobParameter
entities.
ServiceCallJob interface is used for ad-hoc (explicit) run of configured service jobs. User can track execution of Jobs using moqui.service.job.ServiceJobRun
records.
Some important fields of moqui.service.job.ServiceJob entity that you should know-
moqui.service.job.ServiceJobUser
recordsorg.quartz.Trigger
. A cron expression is a string consisting of six or seven subexpressions (fields) that describe individual details of the schedule.
For more details on cron expression, see the documentation at
moqui.service.job.ServiceJobParameter entity stores parameter name, value pair that passes to service on Service Job run.
Methods of ServiceCallJob interface
moqui.service.job.ServiceJobUser
records. The NotificationMessage.message field will be the results of this service call.moqui.service.job.ServiceJobRun
record.For Example-
ec.service.job("ImportEntityDataSnapshot").parameters(context).run()
ImportEntityDataSnapshot job is used to import the Entity Data snapshots. Here job(String jobName) method is used to get a service caller to call a service job. There must be a moqui.service.job.ServiceJob
record for this jobName.
The list of Service Jobs available at System => Server Admin => Service Jobs screen.
Some examples of a schedule job from MoquiInstallData.xml file, which is in place by default in Moqui-
<moqui.service.job.ServiceJob jobName="clean_ArtifactData_daily" description="Clean Artifact Data: ArtifactHit, ArtifactHitBin" serviceName="org.moqui.impl.ServerServices.clean#ArtifactData" cronExpression="0 0 2 * * ?" paused="N">
<parameters parameterName="daysToKeep" parameterValue="90"/>
</moqui.service.job.ServiceJob>
<moqui.service.job.ServiceJob jobName="clean_ServiceJobRun_daily" description="Clean ServiceJobRun Data" serviceName="org.moqui.impl.ServiceServices.clean#ServiceJobRun"
cronExpression="0 0 2 * * ?" paused="N">
<parameters parameterName="daysToKeep" parameterValue="30"/>
</moqui.service.job.ServiceJob>
<moqui.service.job.ServiceJob jobName="send_AllProducedSystemMessages_frequent" description="Send All Produced SystemMessages" serviceName="org.moqui.impl.SystemMessageServices.send#AllProducedSystemMessages" cronExpression="0 0/15 * * * ?" paused="N"/>