public abstract static class KafkaIO.Write<K,V>
extends org.apache.beam.sdk.transforms.PTransform<org.apache.beam.sdk.values.PCollection<org.apache.beam.sdk.values.KV<K,V>>,org.apache.beam.sdk.values.PDone>
PTransform
to write to a Kafka topic with KVs . See KafkaIO
for more
information on usage and configuration.Modifier and Type | Class and Description |
---|---|
static class |
KafkaIO.Write.External
Exposes
KafkaIO.Write as an external transform for cross-language usage. |
Modifier and Type | Field and Description |
---|---|
static java.lang.Class<org.apache.beam.sdk.io.kafka.AutoValue_KafkaIO_Write> |
AUTOVALUE_CLASS |
Constructor and Description |
---|
Write() |
Modifier and Type | Method and Description |
---|---|
org.apache.beam.sdk.values.PDone |
expand(org.apache.beam.sdk.values.PCollection<org.apache.beam.sdk.values.KV<K,V>> input) |
abstract KafkaIO.WriteRecords<K,V> |
getWriteRecordsTransform() |
void |
populateDisplayData(org.apache.beam.sdk.transforms.display.DisplayData.Builder builder) |
KafkaIO.Write<K,V> |
updateProducerProperties(java.util.Map<java.lang.String,java.lang.Object> configUpdates)
Deprecated.
as of version 2.13. Use
withProducerConfigUpdates(Map) instead. |
void |
validate(@Nullable org.apache.beam.sdk.options.PipelineOptions options) |
org.apache.beam.sdk.transforms.PTransform<org.apache.beam.sdk.values.PCollection<V>,org.apache.beam.sdk.values.PDone> |
values()
Writes just the values to Kafka.
|
KafkaIO.Write<K,V> |
withBadRecordErrorHandler(org.apache.beam.sdk.transforms.errorhandling.ErrorHandler<org.apache.beam.sdk.transforms.errorhandling.BadRecord,?> badRecordErrorHandler)
Configure a
ErrorHandler.BadRecordErrorHandler for sending records to if they fail to serialize
when being sent to Kafka. |
KafkaIO.Write<K,V> |
withBootstrapServers(java.lang.String bootstrapServers)
Wrapper method over
KafkaIO.WriteRecords.withBootstrapServers(String) , used to keep the
compatibility with old API based on KV type of element. |
KafkaIO.Write<K,V> |
withConsumerFactoryFn(org.apache.beam.sdk.transforms.SerializableFunction<java.util.Map<java.lang.String,java.lang.Object>,? extends org.apache.kafka.clients.consumer.Consumer<?,?>> consumerFactoryFn)
Wrapper method over
KafkaIO.WriteRecords.withConsumerFactoryFn(SerializableFunction) , used to
keep the compatibility with old API based on KV type of element. |
KafkaIO.Write<K,V> |
withEOS(int numShards,
java.lang.String sinkGroupId)
Wrapper method over
KafkaIO.WriteRecords.withEOS(int, String) , used to keep the compatibility
with old API based on KV type of element. |
KafkaIO.Write<K,V> |
withInputTimestamp()
Wrapper method over
KafkaIO.WriteRecords.withInputTimestamp() , used to keep the compatibility
with old API based on KV type of element. |
KafkaIO.Write<K,V> |
withKeySerializer(java.lang.Class<? extends org.apache.kafka.common.serialization.Serializer<K>> keySerializer)
Wrapper method over
KafkaIO.WriteRecords.withKeySerializer(Class) , used to keep the
compatibility with old API based on KV type of element. |
KafkaIO.Write<K,V> |
withProducerConfigUpdates(java.util.Map<java.lang.String,java.lang.Object> configUpdates)
Update configuration for the producer.
|
KafkaIO.Write<K,V> |
withProducerFactoryFn(org.apache.beam.sdk.transforms.SerializableFunction<java.util.Map<java.lang.String,java.lang.Object>,org.apache.kafka.clients.producer.Producer<K,V>> producerFactoryFn)
Wrapper method over
KafkaIO.WriteRecords.withProducerFactoryFn(SerializableFunction) , used to
keep the compatibility with old API based on KV type of element. |
KafkaIO.Write<K,V> |
withPublishTimestampFunction(KafkaPublishTimestampFunction<org.apache.beam.sdk.values.KV<K,V>> timestampFunction)
Deprecated.
use
KafkaIO.WriteRecords and ProducerRecords to set publish timestamp. |
KafkaIO.Write<K,V> |
withTopic(java.lang.String topic)
Wrapper method over
KafkaIO.WriteRecords.withTopic(String) , used to keep the compatibility
with old API based on KV type of element. |
KafkaIO.Write<K,V> |
withValueSerializer(java.lang.Class<? extends org.apache.kafka.common.serialization.Serializer<V>> valueSerializer)
Wrapper method over
KafkaIO.WriteRecords.withValueSerializer(Class) , used to keep the
compatibility with old API based on KV type of element. |
addAnnotation, compose, compose, getAdditionalInputs, getAnnotations, getDefaultOutputCoder, getDefaultOutputCoder, getDefaultOutputCoder, getKindString, getName, getResourceHints, setDisplayData, setResourceHints, toString, validate
public static final java.lang.Class<org.apache.beam.sdk.io.kafka.AutoValue_KafkaIO_Write> AUTOVALUE_CLASS
public abstract KafkaIO.WriteRecords<K,V> getWriteRecordsTransform()
public KafkaIO.Write<K,V> withBootstrapServers(java.lang.String bootstrapServers)
KafkaIO.WriteRecords.withBootstrapServers(String)
, used to keep the
compatibility with old API based on KV type of element.public KafkaIO.Write<K,V> withTopic(java.lang.String topic)
KafkaIO.WriteRecords.withTopic(String)
, used to keep the compatibility
with old API based on KV type of element.public KafkaIO.Write<K,V> withKeySerializer(java.lang.Class<? extends org.apache.kafka.common.serialization.Serializer<K>> keySerializer)
KafkaIO.WriteRecords.withKeySerializer(Class)
, used to keep the
compatibility with old API based on KV type of element.public KafkaIO.Write<K,V> withValueSerializer(java.lang.Class<? extends org.apache.kafka.common.serialization.Serializer<V>> valueSerializer)
KafkaIO.WriteRecords.withValueSerializer(Class)
, used to keep the
compatibility with old API based on KV type of element.public KafkaIO.Write<K,V> withProducerFactoryFn(org.apache.beam.sdk.transforms.SerializableFunction<java.util.Map<java.lang.String,java.lang.Object>,org.apache.kafka.clients.producer.Producer<K,V>> producerFactoryFn)
KafkaIO.WriteRecords.withProducerFactoryFn(SerializableFunction)
, used to
keep the compatibility with old API based on KV type of element.public KafkaIO.Write<K,V> withInputTimestamp()
KafkaIO.WriteRecords.withInputTimestamp()
, used to keep the compatibility
with old API based on KV type of element.@Deprecated public KafkaIO.Write<K,V> withPublishTimestampFunction(KafkaPublishTimestampFunction<org.apache.beam.sdk.values.KV<K,V>> timestampFunction)
KafkaIO.WriteRecords
and ProducerRecords
to set publish timestamp.KafkaIO.WriteRecords.withPublishTimestampFunction(KafkaPublishTimestampFunction)
, used to keep the
compatibility with old API based on KV type of element.public KafkaIO.Write<K,V> withEOS(int numShards, java.lang.String sinkGroupId)
KafkaIO.WriteRecords.withEOS(int, String)
, used to keep the compatibility
with old API based on KV type of element.public KafkaIO.Write<K,V> withConsumerFactoryFn(org.apache.beam.sdk.transforms.SerializableFunction<java.util.Map<java.lang.String,java.lang.Object>,? extends org.apache.kafka.clients.consumer.Consumer<?,?>> consumerFactoryFn)
KafkaIO.WriteRecords.withConsumerFactoryFn(SerializableFunction)
, used to
keep the compatibility with old API based on KV type of element.@Deprecated public KafkaIO.Write<K,V> updateProducerProperties(java.util.Map<java.lang.String,java.lang.Object> configUpdates)
withProducerConfigUpdates(Map)
instead.public KafkaIO.Write<K,V> withProducerConfigUpdates(java.util.Map<java.lang.String,java.lang.Object> configUpdates)
By default, the producer uses the configuration from KafkaIO.WriteRecords.DEFAULT_PRODUCER_PROPERTIES
.
public KafkaIO.Write<K,V> withBadRecordErrorHandler(org.apache.beam.sdk.transforms.errorhandling.ErrorHandler<org.apache.beam.sdk.transforms.errorhandling.BadRecord,?> badRecordErrorHandler)
ErrorHandler.BadRecordErrorHandler
for sending records to if they fail to serialize
when being sent to Kafka.public org.apache.beam.sdk.values.PDone expand(org.apache.beam.sdk.values.PCollection<org.apache.beam.sdk.values.KV<K,V>> input)
public void validate(@Nullable org.apache.beam.sdk.options.PipelineOptions options)
public void populateDisplayData(org.apache.beam.sdk.transforms.display.DisplayData.Builder builder)
public org.apache.beam.sdk.transforms.PTransform<org.apache.beam.sdk.values.PCollection<V>,org.apache.beam.sdk.values.PDone> values()
KV
s.