Written by

Question Matjaz Murko · Nov 26, 2023

Repeat production process every minute

Hi.

I would like to exchange data with external system every one minute or even more frequent. So I need to trigger production process/operation every minute. How can I do it?

Product version: IRIS 2023.2
$ZV: IRIS for Windows (x86-64) 2023.2 (Build 227U) Mon Jul 31 2023 17:45:52 EDT

Comments

Enrico Parisi · Nov 26, 2023

Very simple, just create a Business Service that use Ens.InboundAdapter.

The default behavior of Ens.InboundAdapter is to call the BS (ProcessInput()) every "CallInterval" seconds.

Something like:

Class Community.bs.TimedService Extends Ens.BusinessService
{

Parameter ADAPTER = "Ens.InboundAdapter";

Method OnProcessInput(pInput As%RegisteredObject, Output pOutput As%RegisteredObject) As%Status
{
	Set BpRequest=##class(Ens.Request).%New()
	Set sc=..SendRequestSync("YourBusinessProcessName",BpRequest,.BpResponse)
	;; OR, if you don't need to wait for the BP to finish:;Set sc=..SendRequestAsync("YourBusinessProcessName",BpRequest)Quit sc
}

}

Add this service to your production, to trigger every one minute set the setting CallInterval=60 (seconds).

Enrico

0
Matjaz Murko  Nov 26, 2023 to Enrico Parisi

But I want just to SEND data to external system every 60s to update it, why should I use Service? Isn't Service used for incomming calls?

0
Rodolfo Moreira dos Santos  Nov 26, 2023 to Matjaz Murko

A business service is responsible for the following activities:

  • Waiting for a specific external event (such as notification from an application, receipt of a TCP message, etc.).
  • Reading, parsing, and validating the data accompanying such an event,
  • Returning, if required, an acknowledgment to the external application indicating that the event was received.
  • Creating an instance of a request message and forwarding it on to the appropriate business process or business operation for processing.

Link: https://docs.intersystems.com/irislatest/csp/docbook/DocBook.UI.Page.cl…

0
Enrico Parisi  Nov 26, 2023 to Matjaz Murko

EVERY interoperability session start from a Business Service, be it from a message/call received from an external system or triggered by a timed event, like in this case.
Your problem/question is:

"I need to trigger production process/operation every minute"

That's EXACTLY what my BS sample does, all you need is to call your "process/operation" that "exchange data with external system".

This is the way to implement it.
Enrico

0
Nicki Vallentgoed  Nov 30, 2023 to Enrico Parisi

Good info!
What happens if the particular task takes longer than a minute and the busines sservice is invoked again?

0
Enrico Parisi  Nov 30, 2023 to Nicki Vallentgoed

Hi Nicki,

that's EXACTLY the point of the two different calls Sync/Async (the second option commented) in my sample.

If you need to wait for the task to finish (whatever it takes, maybe longer that call interval), then use SendRequestSync() call. Using SendRequestSync() if task takes longer than time interval then when it finishes the call is performed immediately because time interval has already expired.

If you need to call the task on every call interval, regardless the previous call has finished, then use SendRequestAsync() call.

Enrico

0