调度java方法在ofbiz中使用特定时间运行

时间:2013-04-24 03:17:44

标签: jobs ofbiz

是否可以安排在ofbiz中特定时间运行的方法?喜欢数据库中的工作吗?

我一直在浏览ofbiz中的服务,我遇到了JobSandbox实体和abiz ofbiz提供了一个非常有用的GUI来设置我假设使用JobSandbox实体的作业的运行。

我只想查看是否有参考或手册让我通过代码设置服务?

1 个答案:

答案 0 :(得分:1)

是的,通过代码安排服务非常容易,请查看以下小片段:

long startTime = new java.util.Date().getTime(); 
 int frequency = RecurrenceRule.DAILY; 
 int interval = 1; 
 int count = 20; 
 LocalDispatcher dispatcher=dctx.getDispatcher(); 
 dispatcher.schedule("myService",_context, startTime, frequency, 
interval, count); 
         }catch (GenericServiceException e){ 
 Debug.logError("Error trying to Schedule My Service: " 
+ e.getMessage()); 
        }