Class DynamicKafkaSourceBuilder<T>
java.lang.Object
org.apache.flink.connector.kafka.dynamic.source.DynamicKafkaSourceBuilder<T>
A builder class to make it easier for users to construct a
DynamicKafkaSource.-
Method Summary
Modifier and TypeMethodDescriptionbuild()Construct the source with the configuration that was set.setBounded(OffsetsInitializer stoppingOffsetsInitializer) Set the source in bounded mode and specify what offsets to end at.setClientIdPrefix(String prefix) Set the client id prefix.setDeserializer(KafkaRecordDeserializationSchema<T> recordDeserializer) Set theKafkaRecordDeserializationSchema.setGroupId(String groupId) Set the property forCommonClientConfigs.GROUP_ID_CONFIG.setKafkaMetadataService(KafkaMetadataService kafkaMetadataService) Set theKafkaMetadataService.setKafkaStreamSubscriber(KafkaStreamSubscriber kafkaStreamSubscriber) Set a custom Kafka stream subscriber.setProperties(Properties properties) Set the properties of the consumers.setProperty(String key, String value) Set a property for the consumers.setStartingOffsets(OffsetsInitializer startingOffsetsInitializer) Set the starting offsets of the stream.setStreamIds(Set<String> streamIds) Set the stream ids belonging to theKafkaMetadataService.setStreamPattern(Pattern streamPattern) Set the stream pattern to determine stream ids belonging to theKafkaMetadataService.
-
Method Details
-
setStreamIds
Set the stream ids belonging to theKafkaMetadataService.- Parameters:
streamIds- the stream ids.- Returns:
- the builder.
-
setStreamPattern
Set the stream pattern to determine stream ids belonging to theKafkaMetadataService.- Parameters:
streamPattern- the stream pattern.- Returns:
- the builder.
-
setKafkaStreamSubscriber
public DynamicKafkaSourceBuilder<T> setKafkaStreamSubscriber(KafkaStreamSubscriber kafkaStreamSubscriber) Set a custom Kafka stream subscriber.- Parameters:
kafkaStreamSubscriber- theKafkaStreamSubscriber.- Returns:
- the builder.
-
setBounded
Set the source in bounded mode and specify what offsets to end at. This is used for all clusters.- Parameters:
stoppingOffsetsInitializer- theOffsetsInitializer.- Returns:
- the builder.
-
setKafkaMetadataService
public DynamicKafkaSourceBuilder<T> setKafkaMetadataService(KafkaMetadataService kafkaMetadataService) Set theKafkaMetadataService.- Parameters:
kafkaMetadataService- theKafkaMetadataService.- Returns:
- the builder.
-
setDeserializer
public DynamicKafkaSourceBuilder<T> setDeserializer(KafkaRecordDeserializationSchema<T> recordDeserializer) Set theKafkaRecordDeserializationSchema.- Parameters:
recordDeserializer- theKafkaRecordDeserializationSchema.- Returns:
- the builder.
-
setStartingOffsets
public DynamicKafkaSourceBuilder<T> setStartingOffsets(OffsetsInitializer startingOffsetsInitializer) Set the starting offsets of the stream. This will be applied to all clusters.- Parameters:
startingOffsetsInitializer- theOffsetsInitializer.- Returns:
- the builder.
-
setProperties
Set the properties of the consumers. This will be applied to all clusters and properties likeCommonClientConfigs.BOOTSTRAP_SERVERS_CONFIGmay be overriden by theKafkaMetadataService.- Parameters:
properties- the properties.- Returns:
- the builder.
-
setProperty
Set a property for the consumers. This will be applied to all clusters and properties likeCommonClientConfigs.BOOTSTRAP_SERVERS_CONFIGmay be overriden by theKafkaMetadataService.- Parameters:
key- the property key.value- the properties value.- Returns:
- the builder.
-
setGroupId
Set the property forCommonClientConfigs.GROUP_ID_CONFIG. This will be applied to all clusters.- Parameters:
groupId- the group id.- Returns:
- the builder.
-
setClientIdPrefix
Set the client id prefix. This appliesKafkaSourceOptions.CLIENT_ID_PREFIXto all clusters.- Parameters:
prefix- the client id prefix.- Returns:
- the builder.
-
build
Construct the source with the configuration that was set.- Returns:
- the
DynamicKafkaSource.
-