Class KafkaTopicSink<T>
- java.lang.Object
-
- org.apache.wayang.core.plan.wayangplan.OperatorBase
-
- org.apache.wayang.core.plan.wayangplan.UnarySink<T>
-
- org.apache.wayang.basic.operators.KafkaTopicSink<T>
-
- All Implemented Interfaces:
java.io.Serializable
,ActualOperator
,ElementaryOperator
,Operator
- Direct Known Subclasses:
JavaKafkaTopicSink
,SparkKafkaTopicSink
public class KafkaTopicSink<T> extends UnarySink<T> implements java.io.Serializable
ThisUnarySink
writes all incoming data quanta to a single Kafka topic.- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.apache.wayang.core.plan.wayangplan.OperatorBase
OperatorBase.GsonSerializer
-
-
Field Summary
Fields Modifier and Type Field Description protected TransformationDescriptor<T,java.lang.String>
formattingDescriptor
protected java.lang.String
topicName
-
Fields inherited from class org.apache.wayang.core.plan.wayangplan.OperatorBase
inputSlots, outputSlots, STANDARD_OPERATOR_ARGS
-
Fields inherited from interface org.apache.wayang.core.plan.wayangplan.Operator
FIRST_EPOCH
-
-
Constructor Summary
Constructors Constructor Description KafkaTopicSink()
KafkaTopicSink(java.lang.String topicName, java.lang.Class<T> typeClass)
Creates a new instance with default formatting.KafkaTopicSink(java.lang.String topicName, FunctionDescriptor.SerializableFunction<T,java.lang.String> formattingFunction, java.lang.Class<T> typeClass)
Creates a new instance.KafkaTopicSink(java.lang.String topicName, TransformationDescriptor<T,java.lang.String> formattingDescriptor)
Creates a new instance.KafkaTopicSink(KafkaTopicSink<T> that)
Creates a copied instance.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static java.util.Properties
getDefaultProperties()
org.apache.kafka.clients.producer.KafkaProducer<java.lang.String,java.lang.String>
getProducer()
org.apache.kafka.clients.producer.KafkaProducer<java.lang.String,java.lang.String>
getProducer(java.util.Properties props)
void
initProducer(KafkaTopicSink<T> kts)
static java.util.Properties
loadConfig(java.lang.String propertiesFilePath)
Load properties from a properties file or alternatively use the default properties with some sensitive values from environment variables.-
Methods inherited from class org.apache.wayang.core.plan.wayangplan.OperatorBase
accept, addBroadcastInput, addTargetPlatform, at, collectMappedInputSlots, collectMappedOutputSlots, copy, createCopy, getAllInputs, getAllOutputs, getCardinalityEstimator, getContainer, getEpoch, getName, getOriginal, getSimpleClassName, getTargetPlatforms, isAuxiliary, isSupportingBroadcastInputs, propagateInputCardinality, propagateOutputCardinality, setAuxiliary, setCardinalityEstimator, setContainer, setEpoch, setName, toString
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.apache.wayang.core.plan.wayangplan.ActualOperator
accept
-
Methods inherited from interface org.apache.wayang.core.plan.wayangplan.ElementaryOperator
createCardinalityEstimator, getCardinalityEstimator, isAuxiliary, setAuxiliary, setCardinalityEstimator
-
Methods inherited from interface org.apache.wayang.core.plan.wayangplan.Operator
addBroadcastInput, addTargetPlatform, broadcastTo, broadcastTo, collectMappedInputSlots, collectMappedOutputSlots, connectTo, connectTo, getAllInputs, getAllOutputs, getCardinalityPusher, getContainer, getEffectiveOccupant, getEffectiveOccupant, getEpoch, getEstimationContextProperties, getForwards, getInnermostLoop, getInput, getInput, getLoopStack, getName, getNumBroadcastInputs, getNumInputs, getNumOutputs, getNumRegularInputs, getOuterInputSlot, getOutermostInputSlot, getOutermostOutputSlots, getOutput, getOutput, getParent, getTargetPlatforms, isAlternative, isElementary, isExecutionOperator, isFeedbackInput, isFeedforwardOutput, isLoopHead, isLoopSubplan, isOwnerOf, isReading, isSink, isSource, isSubplan, isSupportingBroadcastInputs, isUnconnected, propagateInputCardinality, propagateOutputCardinality, propagateOutputCardinality, setContainer, setEpoch, setInput, setName, setOutput
-
-
-
-
Field Detail
-
topicName
protected java.lang.String topicName
-
formattingDescriptor
protected TransformationDescriptor<T,java.lang.String> formattingDescriptor
-
-
Constructor Detail
-
KafkaTopicSink
public KafkaTopicSink()
-
KafkaTopicSink
public KafkaTopicSink(java.lang.String topicName, java.lang.Class<T> typeClass)
Creates a new instance with default formatting.- Parameters:
topicName
- Name of Kafka topic that should be written totypeClass
-Class
of incoming data quanta
-
KafkaTopicSink
public KafkaTopicSink(java.lang.String topicName, FunctionDescriptor.SerializableFunction<T,java.lang.String> formattingFunction, java.lang.Class<T> typeClass)
Creates a new instance.- Parameters:
topicName
- Name of Kafka topic that should be written toformattingFunction
- formats incoming data quanta to aString
representationtypeClass
-Class
of incoming data quanta
-
KafkaTopicSink
public KafkaTopicSink(java.lang.String topicName, TransformationDescriptor<T,java.lang.String> formattingDescriptor)
Creates a new instance.- Parameters:
topicName
- Name of Kafka topic that should be written toformattingDescriptor
- formats incoming data quanta to aString
representation
-
KafkaTopicSink
public KafkaTopicSink(KafkaTopicSink<T> that)
Creates a copied instance.- Parameters:
that
- should be copied
-
-
Method Detail
-
initProducer
public void initProducer(KafkaTopicSink<T> kts)
-
getProducer
public org.apache.kafka.clients.producer.KafkaProducer<java.lang.String,java.lang.String> getProducer()
-
getProducer
public org.apache.kafka.clients.producer.KafkaProducer<java.lang.String,java.lang.String> getProducer(java.util.Properties props)
-
loadConfig
public static java.util.Properties loadConfig(java.lang.String propertiesFilePath)
Load properties from a properties file or alternatively use the default properties with some sensitive values from environment variables.- Parameters:
propertiesFilePath
- - File path or null.- Returns:
- Properties object
-
getDefaultProperties
public static java.util.Properties getDefaultProperties()
-
-