Question
· 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
Discussion (7)3
Log in or sign up to continue

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

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.cls...

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

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