Question Rizki Okta Alhadi · Jan 25, 2024

Call ROUTINE in business service

Hi All,

I have ROUTINE for Get Data end of day. Routine Name is "getTicket.mac" . previously i execute at studio using this command to get data 

w $$getTicket^production.etl.getTicket() and the result success as we want, in this case i want execute routine using BS ( Business Service ) and i want this routine execute every night at 12.00 AM

how to implement this condition.

Thanks For your help and time

Product version: IRIS 2023.1

Comments

Enrico Parisi · Jan 25, 2024

Create a Business Service that use Ens.InboundAdapter and in the OnProcessInput() method call your routine, something like:

Class Community.bs.ServiceTest Extends Ens.BusinessService
{

Parameter ADAPTER = "Ens.InboundAdapter";

Method OnProcessInput(pInput As%RegisteredObject, Output pOutput As%RegisteredObject) As%Status
{
	Set result=$$getTicket^production.etl.getTicket()
	Quit$$$OK
}

}


When you add the Business Service to the production set the setting CallInterval to a VERY LARGE interval (like 99999999), this ensure that the BS is called once.
In the BS settings add a schedule that starts the BS every day at 12 and stops at 13:00 (any time you are sure your call has finished), like: START:*-*-*T12:00:00,STOP:*-*-*T13:00:00

Note that no trace will be visible because the BS does not create any message, you may add some entry in the event log to track execution, something like $$$LOGINFO("Running getTicket") and possibly other info/error handling etc. (depends on your code).

0
Robert Barbiaux  Jan 25, 2024 to Enrico Parisi

To execute the routine at scheduled intervals, you can use the task scheduler with %SYS.Task.RunLegacyTask , that is intended to do exactly what you describe, run a routine.

0
Enrico Parisi  Jan 25, 2024 to Robert Barbiaux

Very true, but the question was:

in this case i want execute routine using BS ( Business Service )

😊

0