The file adapter can read from and write messages to the file system.
This adapter has no requirements other than access to the file system.
The adapter supports the following modes of operation.
|Subscribe||Write a message from Neuron to the file system.|
|Publish||Publish the contents of a file to Neuron.|
When the adapter receives a message from Neuron, the bytes of the body of the message will be written to the file system.
The default file name is <session>_<sequence>.<type>, where:
- Session is a GUID representing the party’s communication session.
- Sequence is the message sequence number.
- Type is the value of the file type property.
If the default file name is not suitable, it can be customized using a property in the adapter metadata.
By default, if the file name already exists on disk, then a numerical suffix will be appended to the file name. The file write option will allow one to overwrite or append the existing file.
A File is read from the file system and the contents of the file will be published to Neuron as an ESBMessage.
Any file with an extension that matches the file type property will be read, published to Neuron, and then deleted from the specified folder path. The file is not deleted until after the ESBMessage has been published. If the file cannot be deleted, then it will be renamed with the new extension: .deleted.
Files with the read-only attribute set will not be processed.
File with the extensions .deleted or .failed will not be processed.
Any message received from Neuron will be discarded when the adapter is in publish mode.
|File Type||Sets the extension of the file to read or write.|
|Folder Path||Sets the folder to read or write files from.|
|Publish Topic||Publish mode only. Sets the topic to publish the message to.|
|Create Folder Path||Subscribe mode only. Automatically create the folder path if it does not exist.|
|File Write Option||Subscribe mode only. Sets the action to take when the file already exists.|
When in subscribe mode, the file type will be the extension of the new file written to disk. When in publish mode, only files will an extension matching the file type will be published to Neuron.
When specifying the publish topic, ensure that the configured party for the adapter endpoint has a publish subscription to the topic.
When the Neuron adapter endpoint has the include metadata option set, then the adapter will look for the following properties in the ESBMessage received from Neuron. The adapter metadata must be specified in the custom properties of the message header.
The names of the properties are case sensitive.
All of the adapter metadata properties are optional even when the include metadata option is set.
|file_out.Name||Sets the name of the file.|
|file_out.Path||Sets the directory the file is written to.|
|file_out.Type||Sets the extension of the file.|
When the Neuron adapter endpoint has the include metadata option set, the following properties will be added to the Neuron ESBMessage as custom properties in the message header.
|file_in.FullName||The full path and name of the file.|
|file_in.Length||The length of the file in bytes.|
|file_in.Name||The name of the file.|
|file_in.Path||The folder where the file was read from.|
|file_in.ReadOnly||True if the file has the read-only attribute set, false otherwise.|
|file_in.Type||The extension of the file.|
The bytes of the body of the ESBMessage will be the contents of the file written to the file system.
The contents of the file will become the body of the ESBMessage.