Managing eMessage Assets Through ThingWorx > File Transfers > Restricting the Maximum File Size for File Transfers
Restricting the Maximum File Size for File Transfers
As of v.1.2.0 of the Axeda Compatibility Package, the eMessage Connector provides a way to enforce the maximum size of a file to be transferred that is set in the File Transfer Subsystem of the ThingWorx Platform.
The ThingWorx Platform FileTransfer Subsystem defines a maxFileSize configuration option (in bytes). The eMessage Connector retrieves the maxFileSize configuration value from the platform and caches it in the FileTransferSubsystemConfigCache, using maxFileSize as a key. By default, this cache will define max-keys = 10 and expire-time = 3600000 (one hour). The default configuration is nested under cx_server.store, with the rest of the stash/cache default configurations.
Refer to Configuring Key/Value Pair Stores for information on configuring the FileTransferSubsystemConfigCache.
* 
If you change the maxFileSize configuration option of the File Transfer Subsystem, you need to clear the maxFileSize configuration value from the FileTransferSubsystemConfigCache on all the eMessage Connectors.
To do this, navigate to the ConnectrionServicesHub Thing in Composer, and run the ClearCacheEntryService with the following input values:
cacheName = FileTransferSubsystemConfigCache
cacheKey = maxFileSize
context = (leave blank)
For example:
File Upload
When executing a file upload, eMessage agents do not report the upload file size until the first chunk is uploaded. When the processing a file upload chunk, the eMessage Connector rejects the upload if the "total" file size reported by the agent is greater than the maxFileSize value set in the File Transfer Subsystem (and stored in the Connector's FileTransferSubsystemConfigCache).
When rejecting the upload, the eMessage Connector responds with HTTP response code 500. When it receives this response code, the agent waits for a configured delay time and then retries the chunk. By default, the agent will send three retries. Once all retries have been exhausted, the agent sends an error to the Connector in a status message. After the Connector processes the error status, the state of the Transfer Job on the ThingWorx Platform is set to ERROR.
* 
The TransferJob starts its completion workflow when the state is set to ERROR. This workflow includes firing FileTransfer events to source and destination Things before the job is removed from the platform.
File Download
The download workflow of the eMessage Connector has been updated to cancel the TransferJob on the platform if the size of the file to be downloaded is greater than the value of the maxFileSize option of the File Transfer Subsystem. If a maxFileSize violation occurs, the TransferJob state on the platform is set to CANCELLED and the file is not delivered to the agent.
* 
The TransferJob starts its completion workflow when the state is set to CANCELLED. This workflow includes firing FileTransfer events to source and destination Things before the job is removed from the platform.
Was this helpful?