Skip to main content
Skip table of contents

File Transfer

Objective

To demonstrate the capability of an application that uses the FileTransmitter and the FileReceiver components to transfer files (text or binary) from a file system to a defined destination.

Prerequisites

  • Start Fiorano Enterprise Server (FES) and Fiorano Peer Server (FPS)
  • Login to the eStudio application
  • Understand the basic menus and perspectives (panels) in the eStudio application

Scenario

Use the FileTransmitter component to send an AVI file (test.avi) from the file system and use the FileReceiver component to save the files to a specified destination. Choose an AVI format for this example so that the commands: pause and resume can be checked while the file is transferred in chunks (a smaller file moves very fast making it difficult to test the commands).

How it Works

The FileTransmitter component reads files from the file system and sends their contents to the output port. Data from the source file is read as bytes and is sent to the output port as chunks. The component provides flexible monitoring capabilities and ensures reliable data transfer.
The FileReceiver component writes the data received on its input port to the output file specified. The component provides flexible monitoring capabilities and robust acknowledgement mechanism.

  • FileTransmitter and FileReceiver components work together as a unit. These components should not be decoupled.
  • FileTransmitter and FileReceiver cannot be configured in Scheduler mode and hence they have to be initiated using commands through a Feeder component.

Components used

Setting up the Example

Configuring FileTransmitter component

To configure the FileTransmitter component, perform the actions below in eStudio:

  1. Add a new Event Process with name 'FileTransfer_Example'.
  2. Drag the FileTransmitter component from File category in the Micro Service Palette to the FileTransfer_Example orchestrator.


    Figure 1: Adding FileTransmitter component to FileTransfer_Example event process

  3. Double-click the FileTransmitter component in the orchestrator to open the Configuration Property Sheet (CPS).
  4. In the Component Configuration panel, click the Source Configuration Ellipsis
    button to set the source directory.


    Figure 2: Navigating to Source Configuration in the FileTransmitter component

  5. In the Source directory text field present in the SourceConfig dialog box, provide the path where the file to be transferred is present (Example: D:\FileTransfer_Transmitter) and click OK.

    • The dot "." that appears in Source directory text box is to enter the relative path. Delete the dot to enter the absolute path.
    • Provide a name in the Named Configuration text box so that the path can be reused.


    Figure 3: Providing Source location 

  6. Click Finish to complete the configuration.

Configuring FileReceiver component

To configure the FileReceiver component, perform the actions below:

  1. In the 'FileTransfer_Example', drag the FileReceiver component from the File category in the Micro Service Palette to the FileTransfer_Example orchestrator.


    Figure 4: Adding File Receiver to FileTransfer_Example event process

  2. Double-click the FileReceiver component in the orchestrator to open the Configuration Property Sheet (CPS).
  3. In the Component Configuration panel, click the Destination Configuration Ellipsis

    button to set the destination directory.


    Figure 5: Navigating to the Destination Configuration in the FileReceiver component

    • Make sure that the three properties below are configured depending on the requirement.
      • Status on Percentage Increase
      • Status on Packets Received Count
      • Status on Delay Interval

      If all three are set to small values, the component sends too many status messages.

    • If file transfer is across the internet, the property Restart timeout needs to be set to a higher value in order to avoid the FileReceiver sending additional acknowledgements unnecessarily.
  4. In the Destination directory text box present in the DestinationConfig dialog box, provide the path where the file needs to be saved (Example: D:\FileTransfer_Receiver) and click OK.


    Figure 6: Providing Destination location

  5. Click Finish to complete the configuration.

Enabling Component Cache

To resume the transfer (if an incomplete transfer exists) on restart of the application, enable component cache by performing the actions below:

  1. Click the FileReceiver component.
  2. Open the Properties panel, go to the Deployment tab and select 'Yes' from the Cache Component drop-down menu.


Figure 7: Enabling Component Cache

Input and Output Ports

Unlike most components, both these components have more than two ports as briefed below.

FileTransmitter Ports


Figure 8: FileTransmitter ports

  1. Input ports
    • ACKNOWLEDGEMENT: Receives acknowledgments from the receiver.
    • COMMAND: Receives commands for file transfer.
  2. Output Ports
    • STATUS: Sends the status of file being transmitted.
    • DATA: Sends file data.

FileReceiver Ports


Figure 9: FileReceiver ports

  1. Input Port
    • DATA: Receives file data.
  2. Output Ports
    • ACKNOWLEDGEMENT: Sends acknowledgments to transmitter.
    • STATUS: Sends the status of the file being transferred.

Composing the Event Process

To compose the Event Process, perform the actions below:

  1. Drag one Feeder component and two Display components from Util category in the Micro Service Palette to the FileTransfer_Example in the Fiorano Orchestrator.


    Figure 10: Adding Feeder and Display components to the FileTransfer_Example

  2. Use any of the two ways mentioned below to rename the components as follows: 'Display1' to 'Display_Transmitter' and Display2 to 'Display_Receiver':
    1. Press F2, change the name and click OK.


      Figure 11: Renaming using Keyboard action 'F2'
       
    2. Go to Name property under General tab in Properties, change the name and press ENTER.


      Figure 12: Renaming using General Properties

    Renaming is to distinguish between the display components connected to the FileTransmitter and the FileReceiver.

  3. Connect the components in the following manner:
    1. Feeder output port to FileTransmitter COMMAND port to feed the required file to the FileTransmitter
    2. FileTransmitter DATA port to FileReceiver DATA port to transfer data from FileTransmitter to FileReceiver
    3. FileReceiver ACKNOWLEDGEMENT port to FileTransmitter ACKNOWLEDGEMENT port to convey acknowledgements about the transfer
    4. FileTransmitter STATUS ports to each Display_Transmitter input port
    5. FileReceiver STATUS ports to each Display_Receiver input port to check the status of events


      Figure 13: Connecting components in the FileTransfer_Example

Running the Example

To run the example, perform the actions below in the Fiorano Orchestrator:

  1. Click the Check Resource and Connectivity
    icon (or press ALT+SHIFT+C) to check resource and connectivity.
     
  2. Click the Run Event Process
    icon (ALT+SHIFT+R) to run the event process. Two Display windows and one Feeder component get opened.
     
  3. In the Feeder component, type the following and click Send and immediately move to the next step:

    CODE
    send <SourceFileName> o
    • Here, 'SourceFileName' is the name of the file at the source and 'o' represents overwrite.
    • If 'o' is not used, it transfers the file just once and the next instance is not processed.
    • To overwrite the file to a different destination, use the syntax:

      CODE
      send <SourceFileName> o [DestinationDirectory]
    • When a Transmitter is transmitting files to a Receiver present on a different type of Operating system, specifying an absolute path for the DestinationDirectory may not work. In such situations, relative path names should be specified, which are appended to the Destination directory configured in the Receiver.



    Figure 14: Sending the command to FileTransmitter component

  4. Type the command pause in the Feeder and click Send to pause the file transfer.
  5. Click the message just above the 'pause' message in the Display_Transmitter. It will have the Percentage of completion less than 100%, since it was paused before completion.


    Figure 15: Display_Transmitter showing percentage of transfer after pausing the transfer

  6. Display_Receiver reflects the same value for Percentage of completion.


    Figure 16: Display_Transmitter showing percentage of file receipt after pausing the transfer

  7. Type resume in the Feeder and click Send to resume the file transfer.


    Figure 17: Sending 'resume' command to resume file transfer
     
  8. The last message in the Display_Transmitter displays the Percentage of completion as 100% indicating that the file transfer is complete.


    Figure 18: Message indicating that the file is transferred completely

  9. The last message in Display_Receiver will have the Percentage of completion as 100% which indicates that the entire file has been transferred.


    Figure 19: Message indicating that the file is received completely

Points to Note

  • Try the following commands as well:
    • status - to check the status of the file being transferred
    • stop <sourceFileName> - to abort the file transfer completely where resume command will not work and where 'send' needs to be used.
  • When multiple Send requests are executed using Send-N times in Feeder, use another Feeder component to send the pause/status command.
  • Contents of the file in the Source Folder can be edited. The edited file will overwrite the old one present in the Destination Folder as 'o' is used in the command for the next transfer.
  • When sending two files, say the test.avi first and test.txt next, the test.avi file will have to transfer completely while the test.txt is queued for transfer. 
    • Only one file can be sent at a time and polling of a directory is not possible. Each action requires designated commands.

Reference


JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.