Written by

Question Ben Webb · Aug 15, 2022

How to execute a class method of a process periodically?

Hi all, 
I have a requirement to periodically poll a URL to fetch some XML data based on a list of query data, lets say every hour, and map what's returned to HL7 then send downstream, I mostly have everything contained within a business process and DTL but I'm lacking a way of invoking the process every X minutes, 
The client has a prefence for as much as possible to be done via out of the box components in the standard HL7 model of  "Service --> Process/Rule/DTL --> Operation" within the Web UI, 
I'm looking for something to act as the Service part that will trigger the  "Process/Rule/DTL --> Operation" parts, 
In Rhapsody we might use a Timer component to send a blank dummy message periodically that triggers some javascript logic and the rest of the flow etc., 
What could I use to provide the same functionality in HealthShare? 
Thanks for your help :)

Product version: HealthShare 2020.1

Comments

Eduard Lebedyuk · Aug 15, 2022

Use a Business Service with a basic Ens.InboundAdapter:

Class test.BS Extends Ens.BusinessService
{

Parameter ADAPTER = "Ens.InboundAdapter";

Method OnProcessInput(pInput As%RegisteredObject, Output pOutput As%RegisteredObject) As%Status
{
	$$$LOGINFO("In OnProcessInput")
	Quit$$$OK
}

}

Add it to production and set Call Interval to X seconds (and Pool Size to 1). That would ensure OnProcessInput being called every X seconds after it's last completion.

0
Ben Webb  Aug 16, 2022 to Eduard Lebedyuk

Perfect, that's what I was looking for, And I would make my calls to the API there, build out a message and send the XML on to the DTL that adapts to HL7?

0
Eduard Lebedyuk  Aug 16, 2022 to Ben Webb

Yes.

Alternatively you can sync call some BO to make an API call, wait for a response and send that to DTL.

It might make sense if you already have a BO/some-other-preexisting-API-caller so you don't have to reimplement the API call code in BS.

0
Ben Webb  Aug 16, 2022 to Evgeny Shvarov

Hi thanks for the reply, this seems like the cleanest way and CRONs are a good option but our client won't accept external libraries 

0