Question
· Apr 26, 2018

Call method just after a service has started

Hi,

I have a service  that I need to receive notifications from when the service has started. Usually this service will be off, but when started a need a method to be called so I can email and be alerted. The only method I know I can use is " OnProcessInput" but this is when an input is received (new file, new message...) but I could not find any events to deal when the service starts...I tried "OnInit" but does not seems to work...any ideas?

Class xxxx Extends Ens.BusinessService
{
Method OnInit() As %Status
{
$$$LOGINFO("INIT")
}
Method OnProcessInput() As %Status
{
// do something here
}
}
Discussion (3)0
Log in or sign up to continue

as you noted SEEMS not to work.

method OnInit() as %Status

This user callback method is called via initConfig() from %OnNew() or in the case of SOAP Services from OnPreSOAP()

 $$$LOGINFO("INIT") translates to
   Do ##class(Ens.Util.Log).LogInfo($$$CurrentClass,$$$CurrentMethod,"INIT")

I'd suggest to replace it by set ^Antonio($i(^Antonio))=$lb($ZDT($h,3),"INIT")

so so find out if your Init gets called or not or multiple times, .. 
Especially during init phase high independence from the rest could be useful