0
点赞
收藏
分享

微信扫一扫

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 条评论