Yes. In addition, to prevent the default Ens.BusinessService behavior to call adapter OnTask() every CallInterval seconds, you can override the OnTask() method of the business service.
And while we are at it 😁 add a TriggerService() class method, and use it in the scheduled task to trigger the service adapter just once :
Class dc.sql.TriggeredSQLService Extends EnsLib.SQL.Service.GenericService
{
Method OnTask() As %Status
{
// do nothing
}
Method Trigger() As %Status
{
return ..Adapter.OnTask()
}
ClassMethod TriggerService(configName As Ens.DataType.ConfigName) As %Status
{
#Dim sc as %Status
#Dim ex as %Exception.AbstractException
#Dim service as Ens.BusinessService
s sc = $$$OK
try {
$$$TOE(sc,##class(Ens.Director).CreateBusinessService(configName,.service))
if service.%Extends($classname()) {
$$$TOE(sc,service.Trigger())
}
}
catch (ex) {
s sc = ex.AsStatus()
}
return sc
}
}
- Log in to post comments

.png)