Question
· 18 hr ago

Run EnsLib.FTP.InboundAdapter on demand

Hello community.

I have a request from a client who wants to do the following.
Currently, they have a data upload process via FTP in which they have implemented a RecordMap to store the information of the CSV files that are uploaded to the FTP directory.
Now they want to have another directory so that it is ONLY executed through an external instruction, not when the file is uploaded to the directory.

Is it possible to create a process that reads the FTP directory on demand? That is, ONLY executes the EnsLib.FTP.InboundAdapter service when we tell it to.
There would be no problem creating an API service that is responsible for receiving the execution request and invoking the Business Service to start it.

Product version: IRIS 2021.1
$ZV: IRIS for Windows (x86-64) 2021.1.3 (Build 389U) Wed Feb 15 2023 14:50:06 EST
Discussion (2)3
Log in or sign up to continue

Yes, it is possible to create a process that reads an FTP directory on demand using InterSystems IRIS or Ensemble, instead of relying on automatic execution upon file upload. This can be achieved by customizing or using an API service to trigger the execution when needed. Here's how you can implement this:

  1. Custom Schedule Control:

    • By default, the EnsLib.FTP.InboundAdapter acts as a daemon and automatically processes files whenever they are uploaded. If you want to execute file reading manually, you can implement an API or script to invoke the process directly rather than relying on its active schedule.
    • The FTP Inbound Adapter has methods like OnProcessInput() that handle the input processing. You can override or modify this behavior for manual triggering via external instructions such as APIs [1][2].
  2. Call the Service Manually Using an API:

    • You can create a custom API endpoint in your production that, when called, retrieves files from the FTP directory and processes them. This is particularly useful if you only want the FTP service to execute upon external request instead of on a periodic polling schedule [1][2].
  3. Example Business Process Setup:

    • You could set up a business service based on EnsLib.FTP.PassthroughService or EnsLib.FTP.InboundAdapter with an execution action controlled by a custom operation or external trigger. Modify the service to accept a triggering parameter to initiate file processing [1][2].
  4. Example Implementation:

    • Create a custom business service class extending the desired FTP adapter (EnsLib.FTP.InboundAdapter) and configure a method that processes files only when a message is received or when a custom trigger is invoked.
    • For instance:

      Class CustomFTPService Extends EnsLib.FTP.InboundAdapter
      {
       Parameter ADAPTER = "EnsLib.FTP.InboundAdapter";
      
       Method TriggerFileProcessing() As %Status
       {
         // Custom logic to process FTP files
         Quit $$$OK
       }
      }
      
    • Additionally, the actual invocation of the adapter's file handling methods such as NameList or GetStream can be customized for manual setups [1][2].
  5. Usage of Management Portal:

    • Add and configure the above operation or method inside your InterSystems Production using the Management Portal. It allows you to create an appropriate API or external service to control the process [2].

If you need additional detail or guidance on specific implementation steps (e.g., invoking external systems or handling the adapter operations), further exploration of the FTP adapter methods is recommended, as they support flexible configurations and manual triggers [1][2].

Sources: