Using FTP Adapters with Ensemble
Settings for the FTP Inbound Adapter
Provides reference information for settings of the FTP inbound adapter, EnsLib.FTP.InboundAdapter.
The inbound FTP adapter has the following settings:
||Server List Style, Delete From Server, File Path, File Spec, Archive Path, Call Interval, FTP Server, FTP Port, Credentials
||SSL Configuration, UsePASV, Stay Connected, Connect Timeout, SFTPPublicKeyFile, SFTPPrivateKeyFile
||Use FileStream, Subdirectory Levels, Charset, Append Timestamp, Semaphore Specification, Confirm Complete, File Access Timeout
Append a time stamp to filenames in the Archive Path
and Work Path
directories; this is useful to prevent possible name collisions on repeated processing of the same filename.
Full path name of the directory on the Ensemble server to save a copy of each file received from the FTP server. This directory must exist, and it must be accessible through the file system on the local Ensemble machine.
If not specified, Ensemble stores the local copy of the file in a temporary location and then deletes it after processing is completed.
The polling interval for the adapter, in seconds. This is the time interval at which the adapter checks for input files in the specified locations.
Upon polling, if the adapter finds a file, it links the file to a stream object and passes the stream object to the associated business service. If several files are detected at once, the adapter sends one request to the business service for each individual file until no more files are found.
If the business service processes each file synchronously, the files will be processed sequentially. If the business service sends them asynchronously to a business process or business operation, the files might be processed simultaneously.
After processing all the available files, the adapter waits for the polling interval to elapse before checking for files again. This cycle continues whenever the production is running and the business service is enabled and scheduled to be active.
The default CallInterval
is 5 seconds. The minimum is 0.1 seconds.
Specifies the character set of the input file. Ensemble automatically translates the characters from this character encoding. The setting value is not case-sensitive. Use Binary
for binary files, or for any data in which newline and line feed characters are distinct or must remain unchanged, for example in HL7 Version 2 or EDI messages. Other settings may be useful when transferring text documents. Choices include:
Binary transfer (the default for the FTP adapters)
Ascii mode FTP transfer but no character encoding translation
The default character encoding of the local Ensemble server
The ISO Latin1 8-bit encoding
The Unicode 8-bit encoding
The Unicode 16-bit encoding
The Unicode 16-bit encoding (Big-Endian)
Any other alias from an international character encoding standard for which NLS (National Language Support) is installed in Ensemble
The Semaphore Specification allows you to indicate that the data file is complete and ready to be read by creating a second file that is used as a semaphore. The inbound FTP adapter waits until the semaphore file exists before checking the other conditions specified by the Confirm Complete requirements and then processing the data file. This allows the application creating the data file to ensure that the adapter waits until the data file is complete before processing it. The adapter tests only for the existence of the semaphore file and does not read the semaphore file contents.
If the Semaphore Specification is an empty string, the adapter does not wait for a semaphore file and processes the data file as soon as the conditions specified by the Confirm Complete requirements are met. If you are using a semaphore file to control when the adapter processes the data file, you should consider setting the Confirm Complete field to None.
The Semaphore Specification allows you to specify individual semaphore files for each data file or a single semaphore file to control multiple data files. You can use wildcards to pair semaphore files with data files, and can specify a series of patterns matching semaphore files to data files. The adapter always looks for a matching semaphore file in the same directory as the data file. If the adapter is looking for data files in subdirectories, the semaphore file must be in the same subdirectory level as its corresponding data file.
The general format for specifying the Semaphore Specification is:
For example, if the Semaphore Specification is:
In a semaphore specification, the * (asterisk) matches any character except dot. In a file specification, the asterisk matches any character including the dot.
You can have one semaphore file control multiple data files. For example, if the Semaphore Specification is:
semaphore file controls when the adapter processes all *.DAT
files in the same directory. When the adapter is looking for data files and corresponding semaphore files, it loops through all the data files at a polling interval. With the previous Semaphore Specification, if it started looking for DATA.SEM
for the ABC.DAT
file and does not find it, it continues looking for the semaphore files for the other files. But, if during this process DATA.SEM
is created and it is looking for a match for XYZ.DAT
, it finds the corresponding semaphore file. But the adapter defers processing XYZ.DAT
until the next polling interval because a preceding data file, ABC.DAT
, was waiting for the same semaphore file.
If you specify multiple pairings, separate them with a ; (semicolon). For example, if the Semaphore Specification is:
The adapter finds the corresponding semaphore file for each data file by reading the Semaphore Specification from left to right. Once it determines the corresponding semaphore file, it stops reading the Semaphore Specification for that file. For example, if the Semaphore Specification is:
The adapter looks for the semaphore file Special.SEM
before it processes VIData.DAT
, but it does not consider VIData.SEM
as a semaphore file for VIData.DAT
. It does consider stuff.SEM
as the semaphore file for stuff.DAT
did not match an earlier specification. Consequently, if you are including multiple specifications that can match the same file, you should specify the more specific specification before the more general ones.
The data file target pattern is case sensitive and the semaphore pattern case sensitivity is operating system dependent, that is *.TXT=*.SEM
.is only applied to target files found ending with capitalized .TXT
but the operating system may not differentiate between *.SEM
. If the operating system is not case-sensitive, the adapter treats semaphore files ending in any case combination of *.SEM
as equivalent but only uses them as the semaphore for data files named *.TXT
. It cannot distinguish case in the semaphore files but can distinguish it in the data files.
If you only specify a single file specification and omit the = (equals) sign, the adapter treats that as the Semaphore Specification for all data files. For example, if the Semaphore Specification is:
This is equivalent to specifying a single wildcard to the left of the = (equals) sign:
If no wildcard is used in the Semaphore Specification then it is the complete fileSpec for the semaphore file. For example, if the Semaphore Specification is:
Then the DataDone.SEM
semaphore file controls when the adapter reads any data file with the .DAT
If a Semaphore Specification is specified and a data file does not match any of the patterns, then there is no corresponding semaphore file and the adapter will not process this data file. You can avoid this situation by specifying * as the last data file in the Semaphore Specification. For example, if the Semaphore Specification is:
is the semaphore file for all files that do not end with .DAT
If an adapter configured with a FileSpec equal to *
, the adapter usually considers all files in the directory as data files. But, if the adapter also has a Semaphore Specification and it recognizes a file as a semaphore file, it does not treat it as a data file.
After the adapter has processed through all the data files in a polling cycle, it deletes all the corresponding semaphore files.
Confirm complete receipt of each file, if possible. This setting handles the case where the file is not completely available on the server at the time downloading begins. When configuring the adapter, choose one of the following options:
May provide fastest performance for small files because no extra FTP directory listing request needs to be done for each file download attempt
This is the default. Size
means keep reading more data for a file until the size reported for it in the server directory listing does not increase. This option is only reliable when the Charset
, because in text mode, the file position used for downloading may become corrupted by the insertion or removal of line feed characters.
Keep trying to read more data for a file until the server allows us to rename it. This option only works if the FTP server grants the rename privilege to Ensemble for the download directory, using the Credentials
configured on this adapter, and if the file permissions on the file itself are set so that the FTP server has privilege to rename it. If not then the Rename attempt always fails, and the Ensemble download never completes.
Size & Rename
option alone may not be sufficient when the FTP servers or source application is sluggish. If the server reports the same size for the file twice, sequentially, 2 seconds apart, Ensemble considers the download complete. Therefore, the Size & Rename
setting is preferable if the server supports rename.
If you are working with the ConfirmComplete
property programmatically, each option has an integer value from 0 (None) to 3 (Size & Rename). The default is Size (integer value 1).
Number of seconds to wait on each attempt to connect to the FTP server. The default is 5 seconds.
True or False. If True, delete files from the FTP server after successful processing. If False, the adapter ignores files already processed until something else deletes them from the FTP server. The default is True.
The default is 10 seconds.
Full pathname of the directory on the FTP server in which to look for files. This directory must exist, and it must be accessible using the Credentials
Filename or wildcard file specification for file(s) to retrieve from the FTP server. For the wildcard specification, use the convention that is appropriate for the operating system on the FTP server machine.
Identifies the TCP port on the FTP server to connect to. The default value is 21.
Identifies the FTP server to connect to. This can be the IP address or server name, as long as the domain host controller can resolve the name.
Identifies the operating system on the FTP server. This determines the type of listing format that the FTP server returns. Choose one of the following:
If the FTP server operating system is OpenVMS, there are two possibilities: VMS
means the inbound adapter retrieves only the latest version of each file; VMSAllVersions
means the inbound adapter retrieves all
versions of each file.
File path to a file containing the SSH private key certificate.
File path to a file containing the SSH public key certificate.
The name of an existing SSL/TLS configuration to use to authenticate this connection. Choose a client SSL/TLS configuration, because the adapter initiates the communication.
Once you indicate you are using SFTP, you can then configure the SFTPPublicKeyFile
settings. If you supply values for both SFTP Public Key File
and SFTP Private Key File
, the adapter attempts key pair authentication. It does this in conjunction with the username and password supplied via the Credentials setting, using the password in the Credentials as the passphrase for the private key.
A zero value means to disconnect immediately after every input event. The default of 1 means to stay permanently connected, even during idle times. Adapters are assumed idle at startup and therefore only auto-connect if they are configured with a StayConnected
value of 1. The only StayConnected
values that are useful in the normal case are 0 and 1. However, StayConnected
can also be a positive number. If the StayConnected
time is longer than the CallInterval
, the adapter stays connected all the time. If the StayConnected
time is shorter than the CallInterval
, the adapter disconnects and reconnects at each CallInterval
Number of levels of subdirectory depth under the given directory that should be searched for files.
Specifies whether the adapter should use file stream for the data received. If this is false, the adapter uses a global stream. Note that regardless of this setting, a file stream will be used if Archive Path
Use Passive FTP mode: server returns a data port address and the client connects to it. Most firewalls are more tolerant of Passive mode FTP because both the control and data TCP connections are initiated by the client.