Class KafkaTopicSource
- java.lang.Object
-
- org.apache.wayang.core.plan.wayangplan.OperatorBase
-
- org.apache.wayang.core.plan.wayangplan.UnarySource<java.lang.String>
-
- org.apache.wayang.basic.operators.KafkaTopicSource
-
- All Implemented Interfaces:
java.io.Serializable
,ActualOperator
,ElementaryOperator
,Operator
- Direct Known Subclasses:
JavaKafkaTopicSource
,SparkKafkaTopicSource
public class KafkaTopicSource extends UnarySource<java.lang.String>
This source reads messages from a Kafka topic and outputs the messages as data units.- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected class
KafkaTopicSource.CardinalityEstimator
-
Nested classes/interfaces inherited from class org.apache.wayang.core.plan.wayangplan.OperatorBase
OperatorBase.GsonSerializer
-
-
Field Summary
-
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 KafkaTopicSource(java.lang.String topicName)
KafkaTopicSource(java.lang.String topicName, java.lang.String encoding)
KafkaTopicSource(KafkaTopicSource that)
Copies an instance (exclusive of broadcasts).
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.Optional<CardinalityEstimator>
createCardinalityEstimator(int outputIndex, Configuration configuration)
org.apache.kafka.clients.consumer.KafkaConsumer<java.lang.String,java.lang.String>
getConsumer()
org.apache.kafka.clients.consumer.KafkaConsumer<java.lang.String,java.lang.String>
getConsumer(java.util.Properties props)
static java.util.Properties
getDefaultProperties()
java.lang.String
getEncoding()
java.lang.String
getTopicName()
void
initConsumer(KafkaTopicSource 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.void
startConsuming()
-
Methods inherited from class org.apache.wayang.core.plan.wayangplan.UnarySource
getOutput, getType
-
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
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
-
-
-
-
Constructor Detail
-
KafkaTopicSource
public KafkaTopicSource(java.lang.String topicName)
-
KafkaTopicSource
public KafkaTopicSource(java.lang.String topicName, java.lang.String encoding)
-
KafkaTopicSource
public KafkaTopicSource(KafkaTopicSource that)
Copies an instance (exclusive of broadcasts).- Parameters:
that
- that should be copied
-
-
Method Detail
-
initConsumer
public void initConsumer(KafkaTopicSource kts)
-
getTopicName
public java.lang.String getTopicName()
-
getEncoding
public java.lang.String getEncoding()
-
getConsumer
public org.apache.kafka.clients.consumer.KafkaConsumer<java.lang.String,java.lang.String> getConsumer()
-
getConsumer
public org.apache.kafka.clients.consumer.KafkaConsumer<java.lang.String,java.lang.String> getConsumer(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()
-
createCardinalityEstimator
public java.util.Optional<CardinalityEstimator> createCardinalityEstimator(int outputIndex, Configuration configuration)
Description copied from interface:ElementaryOperator
- Parameters:
outputIndex
- index of theOutputSlot
for that theCardinalityEstimator
is requestedconfiguration
- if theCardinalityEstimator
depends on further ones, use this to obtain the latter- Returns:
- an
Optional
that might provide the requested instance
-
startConsuming
public void startConsuming()
-
-