Contents

Objective

To demonstrate the capability of an application that use FileTransmitter and 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 eStudio application
  • Understand the basic menus and perspectives (panels) in eStudio application

Scenario

Use FileTransmitter component to send an AVI file (test.avi) from the file system and use FileReceiver 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 gets transferred as 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.

Icon
  • 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 it has to be initiated using commands through a Feeder component.

Components used

Setting up the Example

Configuring FileTransmitter component

To configure FileTransmitter component, perform the following action 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 Configuration Property Sheet (CPS).
  4. In the Component Configuration panel, click the Source Configuration Ellipsis button to set source directory.


    Figure 2: Navigating to Source Configuration in 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 (D:\FileTransfer_Transmitter in this example) and click OK.

    Icon
    • The dot "." that appears in Source directory text box is to enter relative path; delete the dot to enter absolute path.
    • Provide a name in the Named Configuration text box in case the path needs to be used for a future purpose.


    Figure 3: Providing Source location 

  6. Click Finish to complete the configuration.

Configuring FileReceiver component

To configure FileReceiver component, perform the following action in eStudio:

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


    Figure 4: Adding File Receiver to FileTransfer_Example event process

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


    Figure 5: Navigating to Destination Configuration in FileReceiver component

    Icon
    • Make sure that the three properties: Status on Percentage Increase, Status on Packets Received Count, and Status on Delay Interval are configured depending on the requirement. If all the three are set to small values, the component sends too many status messages.
    • If file transfer is across internet, the property Restart timeout needs to be set to a higher value in order to avoid FileReceiver sending additional acknowledgements unnecessarily.
  5. In the Destination directory text box present in the DestinationConfig dialog box, provide the path where the file needs to be saved (D:\FileTransfer_Receiver in this example) and click OK.


    Figure 6: Providing Destination location

  6. Click Finish to complete the configuration.

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

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

This step is however not required for this example, where it is explained for your understanding.


Figure 7: Enabling Component Cache

Input and Output Ports

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

FileTransmitter Ports


Figure 8: FileTransmitter ports

  1. Input ports
    • ACKNOWLEDGEMENT: Receives acknowledgements from 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 acknowledgements to transmitter
    • STATUS: Sends the status of the file being transferred

Composing the Event Process

To compose the Event Process, perform the below actions:

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


    Figure 10: Adding Feeder and Display components to 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
    Icon

    Renaming is to distinguish between the display components connected to FileTransmitter and 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 the components in FileTransfer_Example

Running the Example

To run the example, perform the following actions in the Orchestrator:

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

    Icon
    • Here, 'SourceFileName' is the name of the text file at the source and 'o' represents overwrite.
    • If 'o' is not used, it transfers the file only once and next instance it does not process. However, it is optional in the first instance.
    • To overwrite the file to a different destination, use the following syntax:
      send <SourceFileName> o [DestinationDirectory]
    • In case 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 is appended to the Destination directory configured in 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 Display_Transmitter. It will have the Percentage of completion less than 100% since it got paused before that.


    Figure 15: Display_Transmitter showing partial transfer after pausing the transfer

  6. Display_Receiver reflects the same value for Percentage of completion, as that much amount of transfer is only happened before it got paused.


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

  7. Now, type 'resume' in the Feeder and click Send to resume the file transfer.


    Figure 17: Sending 'resume' command to resume file transfer
  8. Last message in Display_Transmitter displays the Percentage of completion as 100% indicating that the file got transferred completely.


    Figure 18: Message indicating that the file is transferred completely

  9. Last message in Display_Receiver also will have the Percentage of completion as 100% which indicates that the entire file got transferred.


    Figure 19: Message indicating that the file is received completely

Points to Note

  • You may try the following command as well:
    • 'status' to know the status of the file being transferred
    • 'stop <sourceFileName>' to abort the file transfer completely where 'resume' command won't work and have to use 'send' again.
  • When multiple Send requests are executed using Send-N times in Feeder, use another Feeder component to send pause/status command.
  • Content of the file in the Source Folder can be edited. The edited file will overwrite the old one present in the Destination Folder as you use 'o' in the command upon next transfer.
  • If you send two files, say the test.avi first and test.txt at the next moment, it waits for the test.avi file to get transferred completely and keep the test.txt waiting until it finishes the first chucks of file.
  • Only one file can be send at a time and polling of a directory is not possible. Each action requires designated commands as explained in this example document.

Reference

  • Please note that the component options used in this example are minimum, which helps you to get an overview of the application. To explore the other options present in the FileTransmitter and FileReceiver, Feeder and Display components, refer FileTransmitterFileReceiverFeeder and Display sections respectively.
Adaptavist ThemeBuilder EngineAtlassian Confluence