Call method just after a service has started

Primary tabs

Caché

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
}
}

Answers

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

Thanks Robert...very helpful

I noticed that I need to have an ADAPTER to be configured for that service to work...otherwise Init method will not run. As soon as I had an adapter configured...$$$LOGINFO and OnInit method worked...

Thanks