Class CommonKafkaSpoutConfig.Builder<K,V,T extends CommonKafkaSpoutConfig.Builder<K,V,T>>
java.lang.Object
org.apache.storm.kafka.spout.internal.CommonKafkaSpoutConfig.Builder<K,V,T>
- Direct Known Subclasses:
KafkaSpoutConfig.Builder
,KafkaTridentSpoutConfig.Builder
- Enclosing class:
- CommonKafkaSpoutConfig<K,
V>
public abstract static class CommonKafkaSpoutConfig.Builder<K,V,T extends CommonKafkaSpoutConfig.Builder<K,V,T>>
extends Object
-
Constructor Summary
ConstructorDescriptionBuilder
(String bootstrapServers, TopicFilter topicFilter, ManualPartitioner topicPartitioner) Create a KafkaSpoutConfig builder with default property values and no key/value deserializers. -
Method Summary
Modifier and TypeMethodDescriptionabstract CommonKafkaSpoutConfig<K,
V> build()
setFirstPollOffsetStrategy
(FirstPollOffsetStrategy firstPollOffsetStrategy) Sets the offset used by the Kafka spout in the first poll to Kafka broker upon process start.setPartitionRefreshPeriodMs
(long partitionRefreshPeriodMs) Sets partition refresh period in milliseconds.setPollTimeoutMs
(long pollTimeoutMs) Specifies the time, in milliseconds, spent waiting in poll if data is not available.Set aKafkaConsumer
property.Set multipleKafkaConsumer
properties.setProp
(Properties props) Set multipleKafkaConsumer
properties.setRecordTranslator
(Func<org.apache.kafka.clients.consumer.ConsumerRecord<K, V>, List<Object>> func, Fields fields) Configure a translator with tuples to be emitted on the default stream.setRecordTranslator
(Func<org.apache.kafka.clients.consumer.ConsumerRecord<K, V>, List<Object>> func, Fields fields, String stream) Configure a translator with tuples to be emitted to a given stream.setRecordTranslator
(RecordTranslator<K, V> translator) setStartTimeStamp
(long startTimeStamp) Specifies the startTimeStamp if the first poll strategy is TIMESTAMP or UNCOMMITTED_TIMESTAMP.
-
Constructor Details
-
Builder
-
Builder
-
Builder
-
Builder
public Builder(String bootstrapServers, TopicFilter topicFilter, ManualPartitioner topicPartitioner) Create a KafkaSpoutConfig builder with default property values and no key/value deserializers.- Parameters:
bootstrapServers
- The bootstrap servers the consumer will usetopicFilter
- The topic filter defining which topics and partitions the spout will readtopicPartitioner
- The topic partitioner defining which topics and partitions are assinged to each spout task
-
-
Method Details
-
setProp
Set aKafkaConsumer
property. -
setProp
Set multipleKafkaConsumer
properties. -
setProp
Set multipleKafkaConsumer
properties. -
setPollTimeoutMs
Specifies the time, in milliseconds, spent waiting in poll if data is not available. Default is 200ms.- Parameters:
pollTimeoutMs
- time in ms
-
setFirstPollOffsetStrategy
Sets the offset used by the Kafka spout in the first poll to Kafka broker upon process start. Please refer to to the documentation inFirstPollOffsetStrategy
- Parameters:
firstPollOffsetStrategy
- Offset used by Kafka spout first poll
-
setRecordTranslator
-
setRecordTranslator
public T setRecordTranslator(Func<org.apache.kafka.clients.consumer.ConsumerRecord<K, V>, List<Object>> func, Fields fields) Configure a translator with tuples to be emitted on the default stream.- Parameters:
func
- extracts and turns a Kafka ConsumerRecord into a list of objects to be emittedfields
- the names of the fields extracted- Returns:
- this to be able to chain configuration
-
setRecordTranslator
public T setRecordTranslator(Func<org.apache.kafka.clients.consumer.ConsumerRecord<K, V>, List<Object>> func, Fields fields, String stream) Configure a translator with tuples to be emitted to a given stream.- Parameters:
func
- extracts and turns a Kafka ConsumerRecord into a list of objects to be emittedfields
- the names of the fields extractedstream
- the stream to emit the tuples on- Returns:
- this to be able to chain configuration
-
setPartitionRefreshPeriodMs
Sets partition refresh period in milliseconds. This is how often Kafka will be polled to check for new topics and/or new partitions.- Parameters:
partitionRefreshPeriodMs
- time in milliseconds- Returns:
- the builder (this)
-
setStartTimeStamp
Specifies the startTimeStamp if the first poll strategy is TIMESTAMP or UNCOMMITTED_TIMESTAMP.- Parameters:
startTimeStamp
- time in ms
-
getKafkaProps
-
build
-