Package org.apache.camel.component.hdfs
Class HdfsConfiguration
- java.lang.Object
-
- org.apache.camel.component.hdfs.HdfsConfiguration
-
@UriParams public class HdfsConfiguration extends Object
-
-
Constructor Summary
Constructors Constructor Description HdfsConfiguration()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
checkConsumerOptions()
void
checkProducerOptions()
long
getBlockSize()
int
getBufferSize()
int
getCheckIdleInterval()
int
getChunkSize()
HdfsCompressionCodec
getCompressionCodec()
org.apache.hadoop.io.SequenceFile.CompressionType
getCompressionType()
HdfsFileSystemType
getFileSystemType()
HdfsFileType
getFileType()
String
getHostName()
String
getKerberosConfigFileLocation()
String
getKerberosKeytabLocation()
String
getKerberosUsername()
WritableType
getKeyType()
int
getMaxMessagesPerPoll()
List<String>
getNamedNodeList()
String
getNamedNodes()
String
getOpenedSuffix()
String
getOwner()
String
getPath()
String
getPattern()
int
getPort()
String
getReadSuffix()
short
getReplication()
List<HdfsProducer.SplitStrategy>
getSplitStrategies()
String
getSplitStrategy()
URI
getUri()
WritableType
getValueType()
boolean
hasClusterConfiguration()
boolean
hasSplitStrategies()
boolean
isAppend()
boolean
isConnectOnStartup()
boolean
isKerberosAuthentication()
boolean
isOverwrite()
boolean
isStreamDownload()
boolean
isWantAppend()
void
parseURI(URI uri)
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(org.apache.hadoop.io.SequenceFile.CompressionType 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
setOwner(String owner)
The file owner must match this owner for the consumer to pickup the file.void
setPath(String path)
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
setUri(URI uri)
void
setValueType(WritableType valueType)
The type for the key in case of sequence or map files
-
-
-
Method Detail
-
checkConsumerOptions
public void checkConsumerOptions()
-
checkProducerOptions
public void checkProducerOptions()
-
parseURI
public void parseURI(URI uri) throws URISyntaxException
- Throws:
URISyntaxException
-
getUri
public URI getUri()
-
setUri
public void setUri(URI uri)
-
getHostName
public String getHostName()
-
setHostName
public void setHostName(String hostName)
HDFS host to use
-
getPort
public int getPort()
-
setPort
public void setPort(int port)
HDFS port to use
-
getPath
public String getPath()
-
setPath
public void setPath(String path)
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
public HdfsFileType getFileType()
-
setFileType
public void setFileType(HdfsFileType fileType)
The file type to use. For more details see Hadoop HDFS documentation about the various files types.
-
getCompressionType
public org.apache.hadoop.io.SequenceFile.CompressionType getCompressionType()
-
setCompressionType
public void setCompressionType(org.apache.hadoop.io.SequenceFile.CompressionType compressionType)
The compression type to use (is default not in use)
-
getCompressionCodec
public HdfsCompressionCodec getCompressionCodec()
-
setCompressionCodec
public void setCompressionCodec(HdfsCompressionCodec compressionCodec)
The compression codec to use
-
setFileSystemType
public void setFileSystemType(HdfsFileSystemType fileSystemType)
Set to LOCAL to not use HDFS but local java.io.File instead.
-
getFileSystemType
public HdfsFileSystemType getFileSystemType()
-
getKeyType
public WritableType getKeyType()
-
setKeyType
public void setKeyType(WritableType keyType)
The type for the key in case of sequence or map files.
-
getValueType
public WritableType getValueType()
-
setValueType
public void setValueType(WritableType valueType)
The type for the key in case of sequence or map files
-
setOpenedSuffix
public 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.
-
getOpenedSuffix
public String getOpenedSuffix()
-
setReadSuffix
public void setReadSuffix(String readSuffix)
Once the file has been read is renamed with this suffix to avoid to read it again.
-
getReadSuffix
public String getReadSuffix()
-
setPattern
public void setPattern(String pattern)
The pattern used for scanning the directory
-
getPattern
public String 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
public List<HdfsProducer.SplitStrategy> getSplitStrategies()
-
hasSplitStrategies
public boolean hasSplitStrategies()
-
getSplitStrategy
public String getSplitStrategy()
-
setSplitStrategy
public void setSplitStrategy(String splitStrategy)
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
public String getOwner()
-
setOwner
public void setOwner(String owner)
The file owner must match this owner for the consumer to pickup the file. Otherwise the file is skipped.
-
getNamedNodes
public String getNamedNodes()
-
setNamedNodes
public void setNamedNodes(String namedNodes)
A comma separated list of named nodes (e.g. srv11.example.com:8020,srv12.example.com:8020)
-
hasClusterConfiguration
public boolean hasClusterConfiguration()
-
getKerberosConfigFileLocation
public String getKerberosConfigFileLocation()
-
setKerberosConfigFileLocation
public void 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)
-
getKerberosUsername
public String getKerberosUsername()
-
setKerberosUsername
public void setKerberosUsername(String kerberosUsername)
The username used to authenticate with the kerberos nodes
-
getKerberosKeytabLocation
public String getKerberosKeytabLocation()
-
setKerberosKeytabLocation
public 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))
-
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.
-
-