public abstract static class CommonKafkaSpoutConfig.Builder<K,V,T extends CommonKafkaSpoutConfig.Builder<K,V,T>> extends Object
Constructor and Description |
---|
Builder(String bootstrapServers,
Pattern topics) |
Builder(String bootstrapServers,
Set<String> topics) |
Builder(String bootstrapServers,
String... topics) |
Builder(String bootstrapServers,
TopicFilter topicFilter,
ManualPartitioner topicPartitioner)
Create a KafkaSpoutConfig builder with default property values and no key/value deserializers.
|
Modifier and Type | Method and Description |
---|---|
abstract CommonKafkaSpoutConfig<K,V> |
build() |
protected Map<String,Object> |
getKafkaProps() |
T |
setFirstPollOffsetStrategy(FirstPollOffsetStrategy firstPollOffsetStrategy)
Sets the offset used by the Kafka spout in the first poll to Kafka broker upon process start.
|
T |
setPartitionRefreshPeriodMs(long partitionRefreshPeriodMs)
Sets partition refresh period in milliseconds.
|
T |
setPollTimeoutMs(long pollTimeoutMs)
Specifies the time, in milliseconds, spent waiting in poll if data is not available.
|
T |
setProp(Map<String,Object> props)
Set multiple
KafkaConsumer properties. |
T |
setProp(Properties props)
Set multiple
KafkaConsumer properties. |
T |
setProp(String key,
Object value)
Set a
KafkaConsumer property. |
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.
|
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.
|
T |
setRecordTranslator(RecordTranslator<K,V> translator) |
T |
setStartTimeStamp(long startTimeStamp)
Specifies the startTimeStamp if the first poll strategy is TIMESTAMP or UNCOMMITTED_TIMESTAMP.
|
public Builder(String bootstrapServers, TopicFilter topicFilter, ManualPartitioner topicPartitioner)
Create a KafkaSpoutConfig builder with default property values and no key/value deserializers.
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 taskpublic T setProp(Properties props)
Set multiple KafkaConsumer
properties.
public T setPollTimeoutMs(long pollTimeoutMs)
Specifies the time, in milliseconds, spent waiting in poll if data is not available. Default is 200ms.
pollTimeoutMs
- time in mspublic T setFirstPollOffsetStrategy(FirstPollOffsetStrategy firstPollOffsetStrategy)
Sets the offset used by the Kafka spout in the first poll to Kafka broker upon process start. Please refer to to the documentation in FirstPollOffsetStrategy
firstPollOffsetStrategy
- Offset used by Kafka spout first pollpublic T setRecordTranslator(RecordTranslator<K,V> translator)
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.
func
- extracts and turns a Kafka ConsumerRecord into a list of objects to be emittedfields
- the names of the fields extractedpublic 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.
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 onpublic T setPartitionRefreshPeriodMs(long partitionRefreshPeriodMs)
Sets partition refresh period in milliseconds. This is how often Kafka will be polled to check for new topics and/or new partitions.
partitionRefreshPeriodMs
- time in millisecondspublic T setStartTimeStamp(long startTimeStamp)
Specifies the startTimeStamp if the first poll strategy is TIMESTAMP or UNCOMMITTED_TIMESTAMP.
startTimeStamp
- time in mspublic abstract CommonKafkaSpoutConfig<K,V> build()
Copyright © 2022 The Apache Software Foundation. All rights reserved.