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.
Configuration and Testing
The Configuration property sheet of File Transmitter is shown in the figure below.
Figure 1: Sample FileTransmitter Configuration
The table below provides description for the properties in the CPS.
Property | Description |
---|---|
Chunk size | Number of bytes of the source file to be sent in each packet. |
Source Directory | The directory from where the FileTransmitter picks the files to be transmitted. |
Start timeout | Transmitter sends a Start packet to know the existence of receiver(s). This timeout is the time (in milliseconds) to wait before resending a Start packet. |
Packets per update | Number of packets to be sent before saving the transfer state to disk. |
Status on Percentage Increase | Maximum increase in percentage completion before the FileTransmitter sends another status report. |
Status on Packets Transmitted Count | Maximum increase in the number of chunks sent before the FileTransmitter sends another status report. |
Status on Delay Interval | Maximum delay, in milliseconds, before the FileTransmitter sends another status report. |
Delay before retransmission | Delay, in milliseconds, after which the FileTransmitter calculates the file status from the receiver and sends retransmissions. |
The configuration can be validated using the Validate button. Note that this button doesn't check the existence of the source directory. Successful result of the Validate operation appears as below.
Figure 2: Validating the configuration
FileTransmitter Ports
Input Ports
- Command - Accepts the commands.
- Acknowledgement - Receives acknowledgements from the connected FileReceiver component.
Output Ports
- Data – Sends file data
- Status – Sends the status of file(s) being transmitted.
FileTransmitter Commands
Send
Initiates the file transfer to the FileReceiver component.
Syntax: Send <sourceFileName> [o/O] [DestinationDirectory]
Examples:
Send Sample.txt o destDir\
Send Sample1.txt O destDir\Sample2.txt
Send Sample1.txt destDir\subDir\Sample2.txt
Stop
Aborts the transfer of the file specified and sends a kill packet to the connected File receiver which in turn deletes the file being transferred.
Syntax: Stop <sourceFileName>
Example: Stop Sample1.txt
Pause
Puts the FileTransmitter into the paused state, which suspends file transfers until the Resume command is entered.
Syntax: Pause
Resume
Take the FileTransmitter out of the paused state, the file transfers resumes.
Syntax: Resume
Status
This command sends out:
- The state of the FileTransmitter (Paused or Running).
- Names of files for which the transfer has to be resumed (to send the missing packets).
- Names of files that are yet to be transmitted.
Syntax: Status
Functional Demonstration
Below figure shows the event process where a FileTransmitter accepts commands from the Feeder and transmits the files to FileReceiver upon request.
Figure 3: Event process showing the File Transfer components
Scenario 1
Transmitting a file.
Sample Input
Below figure shows the sample input from the Feeder.
Figure 4: Sample input from the Feeder
Sample Output
Below figure shows the status messages sent by the FileTransmitter component.
Figure 5: Status messages sent by the FileTransmitter component
Scenario 2
Requesting a report on the current state of FileTransmitter. In this scenario, 1000 send requests are being sent as shown below and then a Status command is sent as shown in the Sample Input to know the files which need data to be resent, the files that are yet to be sent and the current state of transfer (paused/in progress).
Figure 6: Information dialog box
Sample Input
Figure 7: Sample input
Sample Output
Figure 8: Sample output
Useful Tips
- Make sure that the three properties Status on Percentage Increase, Status on Packets Transmitted Count, and Status on Delay Interval are configured depending on the requirement. If all the three are set to small values, the component sends many status messages.
- If file transfer is across internet, the property Start timeout needs to be tuned appropriately to a higher value in order to avoid FileTransmitter sending multiple Start packets unnecessarily.
- The component's cache must always be set to yes, otherwise the component will not be able to resume a transfer on restart.