Hi Prashanth,

I had a similar requirement once. The following is how I managed it:

First, I setup a method in a CSP dispatch class, which respond to a REST endpoint, to invoke a Business Service in the current namespace working production:

ClassMethod SomeRestEndpointCallback(body As %DynamicArray) As %DynamicObject
{
    $$$TOE(st, ##class(Ens.Director).CreateBusinessService("BusinessServiceName", .service))
    $$$ThrowOnError(service.ProcessInput(body, .output))
    Return output
}

Then, I created a adapterless Business Service (https://docs.intersystems.com/irislatest/csp/docbook/DocBook.UI.Page.cls...) in order to don't pooling for data but just wait for an external trigger instead:

Class some.package.AdapterlessBS Extends Ens.BusinessService
{

/// Configuration item(s) to which to send file stream messages
Property TargetConfigNames As Ens.DataType.ConfigName(MAXLEN = 1000);

Parameter SETTINGS = "TargetConfigNames:Basic:selector?multiSelect=1&context={Ens.ContextSearch/ProductionItems?targets=1&productionName=@productionId}";

Method OnProcessInput(request As %RegisteredObject, Output response As %RegisteredObject) As %Status
{
    Set tSC = $$$OK
    Try {
        // Could be any message... adapter to your needs
        Set tMsg = ##class(Ens.StringResponse).%New()
        Set tMsg.StringValue = "some value"
        
        // Send the message to the targets
        Set targets = $LFS(..TargetConfigNames)
        For i=1:1:$LL(targets) {
            Set target = $LG(targets, i)
            // can be sync or async... it's up to you decide
            //Set tSC = ..SendRequestSync(target, tMsg)
            Set tSC = ..SendRequestAsync(target, tMsg)
            Quit:$$$ISERR(tSC)
        }
    }
    Catch (ex) {
        Set tSC = ex.AsStatus()
    }
    Quit tSC
}

Now, you can add this Business Service to a interoperability production and set the desired Business Process as its target. So, when your REST endpoint is accessed, it will call the BS and then the BP.

HTH,
José

Hi!

Don't know if it's your case, but if you are able to generate the global data, you could use the $INCREMENT() function, which automatically stores the array length into global's head:

Set ^test($INCREMENT(^test)) = "aa"

Set ^test($INCREMENT(^test)) = "aa"

Set ^test($INCREMENT(^test)) = "aa"

Set ^test($INCREMENT(^test)) = "aa"

ZWrite ^test
^test=4
^test(1)="aa"
^test(2)="aa"
^test(3)="aa"
^test(4)="aa"

Write ^test
4

HTH,

José

For those who are looking for unziping features, Embedded Python (for IRIS 2021.2+) allows you to use zipfile Python lib. For instance:

ClassMethod UnZip(pZipFileName As %String, pExtractToDir As %String) [ Language = python ]
{
    #; solution based on this one: https://stackoverflow.com/a/3451150/345422
    import zipfile
    with zipfile.ZipFile(pZipFileName, 'r') as zip_ref:
        zip_ref.extractall(pExtractToDir)
}

Or

ClassMethod UnZip2(pZipFileName As %String, pExtractToDir As %String)
{
    Set zipfile = $SYSTEM.Python.Import("zipfile")
    Do zipfile.ZipFile(pZipFileName, "r").extractall(pExtractToDir)
}

Tested on iris-ml-community:2021.2.0.617.0-zpm