Skip to content

File Adapter

Overview

The file adapter can read from and write messages to the file system.

Requirements

This adapter has no requirements other than access to the file system.

Adapter Modes

The adapter supports the following modes of operation.

ModeDescription
SubscribeWrite a message from Neuron to the file system.
PublishPublish the contents of a file to Neuron.

Subscribe Mode

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.

Publish Mode

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.

Adapter Properties

Property NameDescription
File TypeSets the extension of the file to read or write.
Folder PathSets the folder to read or write files from.
Publish TopicPublish mode only. Sets the topic to publish the message to.
Create Folder PathSubscribe mode only. Automatically create the folder path if it does not exist.
File Write OptionSubscribe 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.

Adapter Metadata

Subscribe Mode

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.

Property NameDescription
file_out.NameSets the name of the file.
file_out.PathSets the directory the file is written to.
file_out.TypeSets the extension of the file.

Publish Mode

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.

Property NameDescription
file_in.FullNameThe full path and name of the file.
file_in.LengthThe length of the file in bytes.
file_in.NameThe name of the file.
file_in.PathThe folder where the file was read from.
file_in.ReadOnlyTrue if the file has the read-only attribute set, false otherwise.
file_in.TypeThe extension of the file.

Message Format

Subscribe Mode

The bytes of the body of the ESBMessage will be the contents of the file written to the file system.

Publish Mode

The contents of the file will become the body of the ESBMessage.

Was this article helpful?
Dislike 0
Previous: FTP Adapter
Next: Microsoft Exchange Adapter