The File Component enables you to perform basic file operations, specifically reading a file into a variable (based on a full filename or the first file in a path matching a wildcard), writing a file to a variable, deleting a file or wildcard pattern, renaming a file, or returning a list of files in a folder matching a wildcard pattern for subsequent enumeration.
Messages can be processed synchronously by waiting for the component to finish
blocking on receipt of a message, or asynchronously by handling the
OnReceiveMessage event.
On the first page of the configuration interface, you must select a File connection. The standard SSIS File Connections are used, allowing you to select a folder or file.
The second page of the configuration interface allows you to select an action, and the associated parameters. You can read, write, delete and enumerate files, and enumerate folders. The dropdown indicate where you can select a variable to provide the value.
If you select the 'Delete file when transaction scope commits' option, valid only for Read operations, any file retrieved will be automatically deleted at the end of the current transaction scope (or after successful retrieval of the file content into the specified variable, if there is no current transaction).
The Timeouts tab enables you to configure how long your component will wait to
pick up a file, and is only applicable to
Read File mode when there is
initially no matching file to pick up. There are two modes of operation -
synchronous and asynchronous. In synchronous mode the task effectively
blocks until a file is received, whereupon it completes and linked tasks can
execute. In asynchronous mode you would typically handle the
OnReceiveMessage event
exposed by the component to handle messages as they arrive. This event has
no parameters, as the received message is already bound to a variable.
The
Delay between poll attempts field allows you to configure the number
of seconds between successive checks on the messaging database to determine if
any matching messages have arrived. The
Get timeout field is the
total number of seconds for the component to wait for a message to arrive before
giving up. The
Fail task on Get timeout option allows you to
determine if such a state should trigger a failure of the component.
Otherwise you can check if a file was retrieved by checking the Message variable
(which will have empty content if no message was retrieved) or using the
ExecValueVariable result.
0 and -1 are special cases for
Get timeout, relating to a zero or
infinite timeout respectively. In the case of a zero timeout, this means
that the component will not wait if there is no message waiting in the messaging
database.
Note that you can also execute this task within a Foreach Loop Container task, to execute the contained tasks once for every file retrieved. Simply select 'BlueSSIS +File Enumerator' as the Enumerator, then click the 'Configure...' button to configure the properties.
BlueSSIS provides a number of enumerators, mostly mapping to associated data retrieval tasks, but also including an Infinite Loop enumerator (useful for manual polling scenarios).