Search code examples
intersystems-ensemble

Get file path from FTPService for use in RoutingEngine


I have a service of class EnsLib.HL7.Service.FTPService that picks up files from multiple subfolders and sends them to an EnsLib.HL7.MsgRouter.RoutingEngine. What I want to do is somehow capture the subfolder as a variable for use in the routing rules. Is this possible?

Let's say I have the following files and directory structure on my FTP Server

/incoming/green/apple.dat

/incoming/yellow/banana.dat

I want the Routing Rule to be able to send anything that came from the /green/ folder to one operation and from /yellow/ to another.


Solution

  • With a message viewer, you can trace any messages. Where you can see any message properties, and one of them is Source. Text in this property looks like:

    Source  apple.dat via FTP localhost:21 path '/incoming/green/'
    

    So with all of this data, you can create a rule by this property in a Rule editorenter image description here