Class EnsLib.FTP.PassthroughService Extends Ens.BusinessService
{
Parameter ADAPTER = "EnsLib.FTP.InboundAdapter";
/// Configuration item(s) to which to send file stream messages
Property TargetConfigNames As %String(MAXLEN = 1000);
Parameter SETTINGS = "TargetConfigNames";
/// Wrap the input stream object in a StreamContainer message object and send
/// it. If the adapter has a value for ArchivePath, send async; otherwise send
/// synchronously to ensure that we don't return to the Adapter and let it
/// delete the file before the target Config Item is finished processing it.
Method OnProcessInput(pInput As %Stream.Object,
pOutput As %RegisteredObject) As %Status
{
Set tSC=$$$OK, tSource=pInput.Attributes("Filename"),
tFileLocation=pInput.Attributes("FTPDir"),
pInput=##class(Ens.StreamContainer).%New(pInput)
Set tWorkArchive=(""'=..Adapter.ArchivePath)
For iTarget=1:1:$L(..TargetConfigNames, ",") {
Set tOneTarget=$ZStrip($P(..TargetConfigNames,",",iTarget),"<>W")
Continue:""=tOneTarget
$$$sysTRACE("Sending input Stream ...")
If tWorkArchive {
Set tSC1=..SendRequestAsync(tOneTarget,pInput)
Set:$$$ISERR(tSC1) tSC=$$$ADDSC(tSC,tSC1)
} Else {
#; If not archiving send Sync to avoid Adapter deleting file before
#; Operation gets it
Set tSC1=..SendRequestSync(tOneTarget,pInput)
Set:$$$ISERR(tSC1) tSC=$$$ADDSC(tSC,tSC1)
}
}
Quit tSC
}
}