Question Soufiane Amroun · Sep 20, 2017

How to program a schedule for an adapterless service

Hi world,

i want to program a schedule for my adapterless business service , i found a method "test" in "Ens.ScheduleHandler" but i don't know how i program it for my service can be invoked each one houre by day .

i'm waiting for your help because it's the key for my application .

i don't like to use ensemble portal.

Thank's.

Comments

Daniel Kutac · Sep 20, 2017

there is an easy solution to your issue. Simply use a Cache Task Manager. Create a new task, and within code, instantiate Ensemble service Ens.Director,

e.g.

Set tSC=##class(Ens.Director).CreateBusinessService("your service configration name",.tService)

If ($$$ISERR(tSC)) Quit
Set tSC=tService.ProcessInput(%request,.output)
If ($$$ISERR(tSC)) Quit
If $IsObject($G(output)) {

   // do whatever you want here

}

0
Steve Pisani  Sep 20, 2017 to Soufiane Amroun

Soufiane,

Following on from Daniel's instructions... Once you have created a class with the suggested your code to invoke your service, add this as a task in Task Manager.  You can ask Task Manager to invoke this every hour.

Sincerely,

Steve 

0
Soufiane Amroun · Sep 20, 2017

thank's Daniel for the answer , my problem is how to trig my service each houre , is there any loop ? i'm beginner in caché .

thank's

0
Eduard Lebedyuk · Sep 20, 2017

To run Business Service once an hour:

  1. Specify Ens.InboundAdapter as an adapter for your Business Service
  2. On Production Configuration page, in Business Service configuration set Call Interval to 3600.
  3. Restart Business Service. It would now be run once an hour (every 36000 seconds)
0