Create task to run a business service just once
Hi,
I have a business service that needs to run only once a day at an specific time. It is important that the service only runs once.
I have tried the scheduler but you can only define the times (start-stop) when the service will be running...so this will not work for me as I need this to run only once.
Looking at the documentation I found "tasks". Apparently this is exactly what I need. As per documentation:
The recommended approach is to configure the business service with Pool Size = 0 and then use the Task Manager to launch a task that calls CreateBusinessService() on it and invokes ProcessInput() on the resulting service instance object. The advantage of calling a business service this way is that you call it at the time you want and it runs only once. If Ensemble happens to be down at that time, your task can register an error.
The problem is that I have no idea how to create a new task. I can figure out how to add code to create the business service and invoke process input method...something like this:
If ($IsObject(tService)) {
Set input = ##class(service class??).%New()
Set input.Value = 22
Set tSC = tService.ProcessInput(input,.output)
}
Anyone knows how can I create that task so I can add that code in?
Thanks