Package org.apache.camel.component.hdfs
Class HdfsConfiguration
java.lang.Object
org.apache.camel.component.hdfs.HdfsConfiguration
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
void
long
int
int
int
int
getOwner()
getPath()
int
getPort()
short
getUri()
boolean
boolean
boolean
isAppend()
boolean
boolean
boolean
boolean
boolean
void
void
setAppend
(boolean append) Append to existing file.void
setBlockSize
(long blockSize) The size of the HDFS blocksvoid
setBufferSize
(int bufferSize) The buffer size used by HDFSvoid
setCheckIdleInterval
(int checkIdleInterval) How often (time in millis) in to run the idle checker background task.void
setChunkSize
(int chunkSize) When reading a normal file, this is split into chunks producing a message per chunk.void
setCompressionCodec
(HdfsCompressionCodec compressionCodec) The compression codec to usevoid
setCompressionType
(HdfsCompressionType compressionType) The compression type to use (is default not in use)void
setConnectOnStartup
(boolean connectOnStartup) Whether to connect to the HDFS file system on starting the producer/consumer.void
setFileSystemType
(HdfsFileSystemType fileSystemType) Set to LOCAL to not use HDFS but local java.io.File instead.void
setFileType
(HdfsFileType fileType) The file type to use.void
setHostName
(String hostName) HDFS host to usevoid
setKerberosConfigFileLocation
(String kerberosConfigFileLocation) The location of the kerb5.conf file (https://web.mit.edu/kerberos/krb5-1.12/doc/admin/conf_files/krb5_conf.html)void
setKerberosKeytabLocation
(String kerberosKeytabLocation) The location of the keytab file used to authenticate with the kerberos nodes (contains pairs of kerberos principals and encrypted keys (which are derived from the Kerberos password))void
setKerberosUsername
(String kerberosUsername) The username used to authenticate with the kerberos nodesvoid
setKeyType
(WritableType keyType) The type for the key in case of sequence or map files.void
setMaxMessagesPerPoll
(int maxMessagesPerPoll) To define a maximum messages to gather per poll.void
setNamedNodes
(String namedNodes) A comma separated list of named nodes (e.g.void
setOpenedSuffix
(String openedSuffix) When a file is opened for reading/writing the file is renamed with this suffix to avoid to read it during the writing phase.void
setOverwrite
(boolean overwrite) Whether to overwrite existing files with the same namevoid
The file owner must match this owner for the consumer to pickup the file.void
The directory path to usevoid
setPattern
(String pattern) The pattern used for scanning the directoryvoid
setPort
(int port) HDFS port to usevoid
setReadSuffix
(String readSuffix) Once the file has been read is renamed with this suffix to avoid to read it again.void
setReplication
(short replication) The HDFS replication factorvoid
setSplitStrategy
(String splitStrategy) In the current version of Hadoop opening a file in append mode is disabled since it's not very reliable.void
setStreamDownload
(boolean streamDownload) Sets the download method to use when not using a local working directory.void
void
setValueType
(WritableType valueType) The type for the key in case of sequence or map files
-
Constructor Details
-
HdfsConfiguration
public HdfsConfiguration()
-
-
Method Details
-
checkConsumerOptions
public void checkConsumerOptions() -
checkProducerOptions
public void checkProducerOptions() -
parseURI
- Throws:
URISyntaxException
-
getUri
-
setUri
-
getHostName
-
setHostName
HDFS host to use -
getPort
public int getPort() -
setPort
public void setPort(int port) HDFS port to use -
getPath
-
setPath
The directory path to use -
isOverwrite
public boolean isOverwrite() -
setOverwrite
public void setOverwrite(boolean overwrite) Whether to overwrite existing files with the same name -
isAppend
public boolean isAppend() -
isWantAppend
public boolean isWantAppend() -
setAppend
public void setAppend(boolean append) Append to existing file. Notice that not all HDFS file systems support the append option. -
getBufferSize
public int getBufferSize() -
setBufferSize
public void setBufferSize(int bufferSize) The buffer size used by HDFS -
getReplication
public short getReplication() -
setReplication
public void setReplication(short replication) The HDFS replication factor -
getBlockSize
public long getBlockSize() -
setBlockSize
public void setBlockSize(long blockSize) The size of the HDFS blocks -
getFileType
-
setFileType
The file type to use. For more details see Hadoop HDFS documentation about the various files types. -
getCompressionType
-
setCompressionType
The compression type to use (is default not in use) -
getCompressionCodec
-
setCompressionCodec
The compression codec to use -
setFileSystemType
Set to LOCAL to not use HDFS but local java.io.File instead. -
getFileSystemType
-
getKeyType
-
setKeyType
The type for the key in case of sequence or map files. -
getValueType
-
setValueType
The type for the key in case of sequence or map files -
setOpenedSuffix
When a file is opened for reading/writing the file is renamed with this suffix to avoid to read it during the writing phase. -
getOpenedSuffix
-
setReadSuffix
Once the file has been read is renamed with this suffix to avoid to read it again. -
getReadSuffix
-
setPattern
The pattern used for scanning the directory -
getPattern
-
setChunkSize
public void setChunkSize(int chunkSize) When reading a normal file, this is split into chunks producing a message per chunk. -
getChunkSize
public int getChunkSize() -
setCheckIdleInterval
public void setCheckIdleInterval(int checkIdleInterval) How often (time in millis) in to run the idle checker background task. This option is only in use if the splitter strategy is IDLE. -
getCheckIdleInterval
public int getCheckIdleInterval() -
getSplitStrategies
-
hasSplitStrategies
public boolean hasSplitStrategies() -
getSplitStrategy
-
setSplitStrategy
In the current version of Hadoop opening a file in append mode is disabled since it's not very reliable. So, for the moment, it's only possible to create new files. The Camel HDFS endpoint tries to solve this problem in this way:- If the split strategy option has been defined, the hdfs path will be used as a directory and files will be created using the configured UuidGenerator.
- Every time a splitting condition is met, a new file is created.
splitStrategy=ST:value,ST:value,...
where ST can be:- BYTES a new file is created, and the old is closed when the number of written bytes is more than value
- MESSAGES a new file is created, and the old is closed when the number of written messages is more than value
- IDLE a new file is created, and the old is closed when no writing happened in the last value milliseconds
-
isConnectOnStartup
public boolean isConnectOnStartup() -
setConnectOnStartup
public void setConnectOnStartup(boolean connectOnStartup) Whether to connect to the HDFS file system on starting the producer/consumer. If false then the connection is created on-demand. Notice that HDFS may take up till 15 minutes to establish a connection, as it has hardcoded 45 x 20 sec redelivery. By setting this option to false allows your application to startup, and not block for up till 15 minutes. -
getMaxMessagesPerPoll
public int getMaxMessagesPerPoll() -
setMaxMessagesPerPoll
public void setMaxMessagesPerPoll(int maxMessagesPerPoll) To define a maximum messages to gather per poll. By default a limit of 100 is set. Can be used to set a limit of e.g. 1000 to avoid when starting up the server that there are thousands of files. Values can only be greater than 0. Notice: If this option is in use then the limit will be applied on the valid files. For example if you have 100000 files and use maxMessagesPerPoll=500, then only the first 500 files will be picked up. -
getOwner
-
setOwner
The file owner must match this owner for the consumer to pickup the file. Otherwise the file is skipped. -
getNamedNodes
-
setNamedNodes
A comma separated list of named nodes (e.g. srv11.example.com:8020,srv12.example.com:8020) -
getNamedNodeList
-
hasClusterConfiguration
public boolean hasClusterConfiguration() -
getKerberosConfigFileLocation
-
setKerberosConfigFileLocation
The location of the kerb5.conf file (https://web.mit.edu/kerberos/krb5-1.12/doc/admin/conf_files/krb5_conf.html) -
getKerberosUsername
-
setKerberosUsername
The username used to authenticate with the kerberos nodes -
getKerberosKeytabLocation
-
setKerberosKeytabLocation
The location of the keytab file used to authenticate with the kerberos nodes (contains pairs of kerberos principals and encrypted keys (which are derived from the Kerberos password)) -
isKerberosAuthentication
public boolean isKerberosAuthentication() -
isStreamDownload
public boolean isStreamDownload() -
setStreamDownload
public void setStreamDownload(boolean streamDownload) Sets the download method to use when not using a local working directory. If set to true, the remote files are streamed to the route as they are read. When set to false, the remote files are loaded into memory before being sent into the route.
-