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.
Components used
- FileTransmitter component
- FileReceiver component
- Feeder component
- Two Display components
Setting up the Example
Configuring FileTransmitter component
To configure the FileTransmitter component, perform the actions below in eStudio:
- Add a new Event Process with name 'FileTransfer_Example'.
- 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 - Double-click the FileTransmitter component in the orchestrator to open the Configuration Property Sheet (CPS).
- 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 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.
Figure 3: Providing Source locationClick Finish to complete the configuration.
Configuring FileReceiver component
To configure the FileReceiver component, perform the actions below:
- 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 - Double-click the FileReceiver component in the orchestrator to open the Configuration Property Sheet (CPS).
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- 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 - Click Finish to complete the configuration.
Input and Output Ports
Unlike most components, both these components have more than two ports as briefed below.
FileTransmitter Ports
Figure 8: FileTransmitter ports
- Input ports
- ACKNOWLEDGEMENT: Receives acknowledgments from the receiver.
- COMMAND: Receives commands for file transfer.
- Output Ports
- STATUS: Sends the status of file being transmitted.
- DATA: Sends file data.
FileReceiver Ports
Figure 9: FileReceiver ports
- Input Port
- DATA: Receives file data.
- 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:
- 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 - Use any of the two ways mentioned below to rename the components as follows: 'Display1' to 'Display_Transmitter' and Display2 to 'Display_Receiver':
- Press F2, change the name and click OK.
Figure 11: Renaming using Keyboard action 'F2'
- Go to Name property under General tab in Properties, change the name and press ENTER.
Figure 12: Renaming using General Properties
- Press F2, change the name and click OK.
- Connect the components in the following manner:
- Feeder output port to FileTransmitter COMMAND port to feed the required file to the FileTransmitter
- FileTransmitter DATA port to FileReceiver DATA port to transfer data from FileTransmitter to FileReceiver
- FileReceiver ACKNOWLEDGEMENT port to FileTransmitter ACKNOWLEDGEMENT port to convey acknowledgements about the transfer
- FileTransmitter STATUS ports to each Display_Transmitter input port
- 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:
- Click the Check Resource and Connectivity icon (or press ALT+SHIFT+C) to check resource and connectivity.
- Click the Run Event Process icon (ALT+SHIFT+R) to run the event process. Two Display windows and one Feeder component get opened.
In the Feeder component, type the following and click Send and immediately move to the next step:
Figure 14: Sending the command to FileTransmitter component- Type the command
pause
in the Feeder and click Send to pause the file transfer. - 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 - Display_Receiver reflects the same value for Percentage of completion.
Figure 16: Display_Transmitter showing percentage of file receipt after pausing the transfer - Type
resume
in the Feeder and click Send to resume the file transfer.
Figure 17: Sending 'resume' command to resume file transfer
- 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 - 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 transferredstop <sourceFileName>
- to abort the file transfer completely whereresume
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
- Download FileTransfer_Example event process and import it to the Event Process Repository in the Server Explorer in eStudio to understand the configuration used in this example and to execute the working sample.
- Please note that the component options used in this example are basic to acquire an overview of the application. To explore other options present in the FileTransmitter and FileReceiver, Feeder and Display components, refer to the FileTransmitter, FileReceiver, Feeder and Display sections respectively.