Question
· Jul 26, 2017

Ensemble async passthrough configuration

I'm trying to create asynchronous Ensemble service/operation pair for SOAP passthrough.

General configuration:

  • Ensemble Service receives a message and immediately returns an answer to a caller (message received or some error)
  • Ensemble Service asynchronously calls Business Operation
  • Business Operation  does guaranteed message delivery, etc.

Is it a viable approach?

Any tips? Ideas? Caveats? Code?

Seems like I can sublass EnsLib.SOAP.GenericService and change Sync to ASync (and provide a default reply immediately).

Discussion (3)2
Log in or sign up to continue

Here's what I came up with.

Business service (works in SYNC or ASYNC mode depending on OneWay setting):

Class Passthrough.PassthroughService Extends EnsLib.SOAP.GenericService
{

Property DefaultResponce As %String(MAXLEN = "") [ InitialExpression = "<soap:Envelope><soap:Body></soap:Body></soap:Envelope>" ];

Parameter SETTINGS = "OneWay:Basic";

/// Pass through to OnProcessInput()
Method ProcessBody(pAction As %String, pRequestBody As %CharacterStream, pResponseBody As %CharacterStream) As %Boolean
{
    Set tSC=..ProcessInput(pRequestBody, .pResponseBody, pAction)
    Set:pResponseBody="" pResponseBody = ..DefaultResponce
    Quit $$$OK
}

}

And a BP for ASYNC logging (you need to set it as a target for BS only if you want ASYNC mode and logging, otherwise just call BO directly):

Class Passthrough.PassthroughProcess Extends Ens.BusinessProcess [ ClassType = persistent ]
{

/// Configuration item to which to send messages
Property TargetConfigName As Ens.DataType.ConfigName;

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

Method OnRequest(pRequest As EnsLib.SOAP.GenericMessage, Output pResponse As EnsLib.SOAP.GenericMessage) As %Status
{
    Quit ..SendRequestSync(..TargetConfigName, pRequest, .pResponse)
}

}

Default EnsLib.SOAP.GenericOperation can be used for BO.