public static class KafkaIO.TypedWrite<K,V> extends PTransform<PCollection<KV<K,V>>,PDone>
PTransform to write to a Kafka topic. See KafkaIO for more
information on usage and configuration.| Modifier and Type | Field and Description |
|---|---|
protected Coder<K> |
keyCoder |
protected Map<String,Object> |
producerConfig |
protected com.google.common.base.Optional<SerializableFunction<Map<String,Object>,org.apache.kafka.clients.producer.Producer<K,V>>> |
producerFactoryFnOpt |
protected String |
topic |
protected Coder<V> |
valueCoder |
name| Modifier | Constructor and Description |
|---|---|
protected |
TypedWrite(String topic,
Coder<K> keyCoder,
Coder<V> valueCoder,
Map<String,Object> producerConfig,
com.google.common.base.Optional<SerializableFunction<Map<String,Object>,org.apache.kafka.clients.producer.Producer<K,V>>> producerFactoryFnOpt) |
| Modifier and Type | Method and Description |
|---|---|
PDone |
apply(PCollection<KV<K,V>> input) |
void |
validate(PCollection<KV<K,V>> input) |
PTransform<PCollection<V>,PDone> |
values()
Returns a new transform that writes just the values to Kafka.
|
KafkaIO.TypedWrite<K,V> |
withProducerFactoryFn(SerializableFunction<Map<String,Object>,org.apache.kafka.clients.producer.Producer<K,V>> producerFactoryFn)
Returns a new
KafkaIO.Write with a custom function to create Kafka producer. |
getDefaultOutputCoder, getDefaultOutputCoder, getDefaultOutputCoder, getKindString, getName, populateDisplayData, toStringprotected final String topic
protected final com.google.common.base.Optional<SerializableFunction<Map<String,Object>,org.apache.kafka.clients.producer.Producer<K,V>>> producerFactoryFnOpt
public KafkaIO.TypedWrite<K,V> withProducerFactoryFn(SerializableFunction<Map<String,Object>,org.apache.kafka.clients.producer.Producer<K,V>> producerFactoryFn)
KafkaIO.Write with a custom function to create Kafka producer. Primarily used
for tests. Default is KafkaProducerpublic PTransform<PCollection<V>,PDone> values()
KVs.public PDone apply(PCollection<KV<K,V>> input)
apply in class PTransform<PCollection<KV<K,V>>,PDone>public void validate(PCollection<KV<K,V>> input)
validate in class PTransform<PCollection<KV<K,V>>,PDone>Copyright © 2016 The Apache Software Foundation. All rights reserved.