We have done something similar where we pass the outbound folder to the Operation. So basically, we have many different Services receiving data (TCP, FTP, FIle) and each Service has OutboundFilePath Property that is passed to only one Operation. We extended the Ens.StreamContainer to add the OutboundFilePath to the Stream. The Operation uses the OutboundFilePath Property from the Stream to write the file to the folder.
<OutboundFilePath>D:\FOLDER\SUBFOLDER\SUB</OutboundFilePath>
</StreamContainer>
Operation extends Ens.BusinessOperation
Method OnMessage(pRequest As AIECommon.Stream.StreamContainer, Output pResponse As %Persistent) As %Status
{
Quit:'$IsObject(pRequest.Stream) $$$ERROR($$$EnsErrGeneral,"No Stream contained in StreamContainer Request")
Set tFilename=pRequest.GenerateFileName
Set tCfgOutboundPath = pRequest.OutboundFilePath
Set ..Adapter.FilePath = tCfgOutboundPath
Set tSC=..Adapter.PutStream(tFilename, pRequest.Stream)
Do pRequest.%Save() ; re-save in case PutStream() optimization changed the Stream filename
Quit tSC
}
- Log in to post comments