Samba component
The Samba component connects to file servers that support the SMB/CIFS protocol (Windows File Sharing). It can act either as an outbound (writing files) or inbound component (reading files).
When it is not the first component in a flow it acts as an outbound component (writing files) by default.
- Full SMB2 support and partial SMB3 support.
- DFS file shares are not supported.
Basic configuration
The Samba component has the following basic configuration options:
Force inbound
This option is only available when the Samba component is not the first component in a flow. It overrules the default outbound mode (writing files) and forces the component into inbound mode (reading files).
When the route is followed, only one message at a time is consumed if the component is forced into inbound mode.
The body of the message before the Samba component will be overridden with the content of the consumed file.
Domain
Specify the Windows domain the user belongs to.
Host
Specify the host (URL or IP address) of the file server, e.g. smb.example.org
or 149.210.209.32
.
Port
Specify the port of the file server. By default this is 139
.
Username
Specify the user account for the file server.
Password
Specify the password for the user account.
Share name
Specify the name of the share you want to connect to.
Don't include a /
at the end of the share name, the component is not able to write files to the server when you do.
Path
Specify the path to the target directory. In outbound mode this is the directory where the file(s) are written to. In inbound mode this is the directory where files are being read from.
File Name
Only pick up files with this filename in inbound mode or set the file name when outbound. You can't use wildcards in this field.
Charset
Specify the encoding of the file.
When writing large text files such as XML or JSON, you may choose to leave this option empty. The file will be processed as binary and its content does not have to be read into memory to validate the charset. This greatly improves performance and can prevent errors when parsing the file later.
File Exist
Specify what to do if a file with the same name already exists.
Options
Override
(default)Append
Ignore
Fail
Only available when the component is in outbound mode.
Delay
The amount of time (in milliseconds) to wait before the next poll of the file/directory.
Only available when the component is in inbound mode.
Advanced configuration
The Samba component has the following advanced configuration options:
Auto Create
Automatically create missing directories in the file path.
Options
Yes
(default)No
Only available when the component is in outbound mode.
Recursive
Specifies if only files in the specified path should be read (No
) or if files in all subdirectories should be included (Yes
).
Options
Yes
No
(default)
If this option is set to Yes
and you want to move files into a subdirectory after processing, make sure that these folders are hidden (prepended with a .
). Hidden folders are excluded from polling and you don't end up with an infinite loop.
Only available when the component is set to inbound mode.
Delete file
Specifies wether files are deleted after processing.
Options
Yes
No
(default)
- When set to
Yes
, the Move to option is ignored and hidden. - Only available when the component is set to inbound mode.
Order by
Specify the order in which files are read from the server.
Options
Default
(no guaranteed order)File name (ascending)
(A-Z)File name (descending
(Z-A)Modified date (ascending)
(old-new)Modified date (descending)
(new-old)
Only available when the component is set to inbound mode.
Maximum batch size
Maximum number of files processed on each poll. When left empty (default) all files to be read will be processed at once, as quickly as possible.
Only available when the component is set to inbound mode.
Move to
The relative path of the directory where files are moved to after processing. The default is set to .dovetail
.
Use ../[folder_name]
or ../../[folder_name]
to move up folders.
Specify a path that starts without a .
(dot) if your Samba server doesn't allow the creation of 'hidden' directories or files.
- Only used and shown when Delete file is set to
No
. - Only available when the component is set to inbound mode.
Because the Samba component polls the Move to directory before moving a file, having a large number of files in this directory may create a performance bottleneck in file processing. Consider removing files from this directory to improve performance.
Local work directory
Specify a local temporary directory where files are copied for processing. This is used to store the remote file content directly in local files to avoid loading the content into memory. This is beneficial when working with larger remote files and it can conserve memory.
Only available when the component is set to inbound mode.
Read lock
If set to Changed
, the component only consumes the files if it has exclusive read-lock on the file (i.e. the file is not in-progress or being written). It will wait until the file lock is granted.
Options
None
(default)Changed
- Requires write permissions on the Samba server.
- Uses file length or file modification timestamp to detect whether the file is currently being changed or not. It will at least use 1 second to check this and there will also be some time between each check, so reading files will be slower.
- Requires a lock on the latest file until a new file has been written to the Samba server. It will not be processed until a new file has been dropped on the Samba server.
Only available when the component is set to inbound mode.
Include
Include files if the filename matches the specified regular expression (regex) pattern.
- Can't be used in combination with File name.
- Only available when the component is set to inbound mode.
- Only works for filenames, not folder structures.
Exclude
Exclude files if the filename matches the specified regular expressions (regex) pattern.
- Can't be used in combination with File name.
- Only available when the component is set to inbound mode.
- Only works for filenames, not folder structures.
A great resource to create and evaluate regex is Regex 101.
Make sure to set Flavour to Java 8
in the left column when creating regex for Dovetail.
Initial delay
The amount of time (in milliseconds) to wait before the 'polling' of files/directories starts.
Only available when the component is set to inbound mode.