Samba component
The Samba component is able to connect to file servers that support the SMB/CIFS protocol (Windows File Sharing), both as an inbound component (reading files) and as an outbound component (writing files).
Basic configuration
The Samba component has the following basic configuration options:
Force inbound
Description
Settings this to Yes
will force the component to turn from outbound to inbound
and consume a file from the (S)FTP(S) server. This has the same behavior as putting
the component below an Enrich component that is set
to Override
. This means that the current body will be overridden with the new body
of the consumed file.
Remarks
- Only available when component is outbound.
- Only one file will be consumed when the component is forced to be inbound.
- This options only becomes visible when another component is connected on the left side of this component.
Domain
Description
Specify the Windows domain the user belongs to.
Host
Description
URL or IP address of the file server e.g. smb.example.org
, 149.210.209.32
.
Port
Description
Specify a custom TCP/IP port, by default 139
is used
Username
Description
The name of the user account for the file server.
Password
Description
The password that belongs to the user account for the file server.
Path
Description
Path to indicate which share and which directory it should poll, like
share/directory/
. In case of inbound this is the directory where Dovetail will
be picking up files from, if used as outbound this is the directory where Dovetail
will write files to.
Remarks
- If you include a
/
at the end of the path, the component will try to copy the whole file path and not the file name by itself.
File Name
Description
Get specific file with this name when inbound or set file name when outbound.
Charset
Description
Specifies the encoding of the file.
Remarks
- Only available when component is outbound.
- When processing large text files see Producing large text files below.
File Exist
Options
Override
(default)Append
Ignore
Fail
Description
Specify what to do if a file with the same name already exists.
Remarks
- Only available when component is outbound.
Delay
Description
Milliseconds to wait before the next poll of the file/directory.
Remarks
- Only available when the component is inbound.
Advanced configuration
The Samba component has the following advanced configuration options:
Auto Create
Options
Yes
(default)No
Description
Automatically creates missing directories in the file path.
Remarks
- Only available when component is outbound.
Recursive
Options
Yes
No
(default)
Description
When inbound, specifies whether Dovetail should process files only in the
specified path (No
) or in all subdirectories of the path too (Yes
).
Remark
When set to Yes
you must make sure that your exclude pattern
will ignore the directory were you place the processed files, otherwise you will
end up with a infinite loop.
Delete file
Options
Yes
No
(default)
Description
If set to Yes
, the file will be deleted after it is processed.
Remarks
- Only available when the component is inbound.
- When set to
Yes
, the Move option is ignored and hidden.
Move
Description
Relative path to folder where files should be moved to when done processing.
Create and move files into this folder when done processing. This should be a
relative path. In order to move to higher paths use ../[folder name]
or
../../[folder name]
.
Remarks
- Only available when the component is inbound.
- Only used and shown when Delete file is set to
No
. - Files can be moved to folders higher in the hierarchy with
..
, for example:../[folder name]
or../../[folder name]
. - The default behavior is to create a directory named
.dovetail
and move everything into that directory when files are processed. However some (S)FTP(S) servers don't allow creating.\*
files or directories. In this case, you need to change the name of the.dovetail
directory to something that is accepted by the server.
Local work directory
Description
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.
Remarks
- Only available when the component is inbound.
Read lock
Options
none
changed
Description
If set to changed
, 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.
Remarks
- Only available when component is inbound.
When set to changed
:
- It requires write permissions on the (S)FTP(S) server.
- It 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 consuming files will be slower.
- It will require a lock on the latest file until a new file has been written to the (S)FTP(S) server. It will not be processed until a new file has been dropped at the ftp server.
Include
Description
Used to include files, if the filename matches the regular expressions pattern.
Remarks
- Only available when the component is inbound.
Exclude
Description
Used to exclude files, if the filename matches the regular expressions pattern.
Remarks
- Only available when the component is inbound.
Initial delay
Description
Milliseconds to wait before polling the file/directory starts.
Remarks
- Only available when the component is inbound.
Producing large text files (> 10 MB)
When producing large text files like XML
or JSON
you might want to leave the
charset
option empty. This tells Dovetail that it should read the file as binary
which means it does not have to read all the file's content into memory to validate
the charset. This is better for it's performance and can prevent errors parsing
the file later on in the flow.
Remarks
- Moving or deleting files:
When the DeleteFile is set to
true
, the Move option is ignored. When the DeleteFile property is not set totrue
, processed files will be moved to a .camel directory. ReadLock
This option is used while 'consuming', to only poll the files if it has exclusive read-lock on the file (i.e. the file is not in-progress or being written). The options arenone
orchanged
.Move
the default behavior is to create a .camel directory and move everything into that directory when it's processed.Recursive
Watch out when enabled! You must make sure that your Exclude pattern will ignore the directory were you place the processed files, otherwise you will end up with a infinite loop!- The component doesn't support DFS file shares.
- This component only supports version 1 of the SMB protocol.