0

is it possible to schedule methods to run on specific times in ofbiz? like jobs in databases?

i have been doing some reading on services in ofbiz and I came across the JobSandbox Entity aand ofbiz provides a very helpful GUI to setup the running of the jobs which I assume uses the JobSandbox Entity.

I just want to see if there is a reference or manual that would let me setup the service through code?

chip
  • 3,039
  • 5
  • 35
  • 59

1 Answers1

1

Yes, it is very easy to schedule a service through the code, please check this small snippet:

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()); 
        } 
Sergei
  • 145
  • 1
  • 5