ofbiz中job任务应用

ofbiz中job任务应用[url]http://www.verydemo.com/demo_c441_i15344.html[/url]
ofbiz中job任务应用 [url]http://www.45542.com/kaiyuan-soft/1042025.html[/url]
ofbiz进阶分析--Ofbiz开发之 异步服务与计划任务(Job Scheduler) 分析[url]http://www.tools138.com/create/article/20140315/050036937.html[/url]


TemporalExpression表达式:图片在[url]http://panyongzheng.iteye.com/blog/2084855[/url]
[img]http://dl2.iteye.com/upload/attachment/0099/8961/a1394878-b26a-3429-a821-134f6d11f282.png[/img]
示例:现在来定义一个14天后的表达式
<TemporalExpression tempExprId="PM" tempExprTypeId="FREQUENCY" description="Every Other Monday at 5pm" date1="2000-01-03 17:00:00.000" integer1="5" integer2="14"/> 

integer1="5" 可以看出规则类型是Day,integer2="14",所以说是14天。


示例:
[b]增加Schedule的定义[/b]
/framework/service/data/ScheduledServices.xml
-----------------------------------------------------------------
<TemporalExpression tempExprId="my_job_teId" tempExprTypeId="FREQUENCY" description="20 Second" date1="2014-07-27 12:30:00.000" integer1="13" integer2="20"/>
<JobSandbox jobId="my_job_id" jobName="Test Jobs" runTime="2014-07-27 12:30:00.000" serviceName="myScheduleMethod" poolId="pool" runAsUser="system" tempExprId="my_job_teId" maxRecurrenceCount="-1"/>



[b]定义Service配置:[/b]在framework或者自定义工程里面的[color=red]其中一个[/color]services.xml增加service的配置
applications/自定义工程/servicedef/services.xml
-----------------------------------------------------------------
    <service name="myScheduleMethod" engine="java"
location="com.pandy.MySchedule.SendEmailUtil" invoke="myScheduleMethod" auth="false"
use-transaction="false" semaphore="wait">
<description>my demo</description>
<attribute name="oper" type="String" mode="IN" optional="true" />
<attribute name="success" type="Object" mode="OUT" optional="true"/>
<attribute name="__CUSTOM_JSON_OBEJECT__" type="Object" mode="OUT" optional="true"/>
</service>



framework/service/servicedef/services.xml
-----------------------------------------------------------------
    <service name="myScheduleMethod" engine="java"
location="com.pandy.MySchedule.SendEmailUtil" invoke="myScheduleMethod" auth="false"
use-transaction="false" semaphore="wait">
<description>my demo</description>
<attribute name="oper" type="String" mode="IN" optional="true" />
<attribute name="success" type="Object" mode="OUT" optional="true"/>
<attribute name="__CUSTOM_JSON_OBEJECT__" type="Object" mode="OUT" optional="true"/>
</service>



[b]定义Service的类和方法[/b]:
com.pandy.MySchedule的方法
-----------------------------------------------------------------
public static Map<String, Object> myScheduleMethod(DispatchContext dctx, Map<String, ? extends Object> context) {
//执行的代码
return 一个Map对象,包含的信息参考定义service的xml;
}


[b]数据库表[/b]:做ant load-demo的时候 自动把上面的配置放到这些表里面,不用理会。
temporal_expression
job_sandbox
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值