public class PersistentKafkaSource<OUT>
extends org.apache.flink.streaming.api.functions.source.RichParallelSourceFunction<OUT>
implements org.apache.flink.api.java.typeutils.ResultTypeQueryable<OUT>, org.apache.flink.streaming.api.checkpoint.CheckpointCommitter, org.apache.flink.streaming.api.checkpoint.CheckpointedAsynchronously<long[]>
| Modifier and Type | Class and Description |
|---|---|
static class |
PersistentKafkaSource.KafkaZKStringSerializer |
| Constructor and Description |
|---|
PersistentKafkaSource(String topicName,
org.apache.flink.streaming.util.serialization.DeserializationSchema<OUT> deserializationSchema,
kafka.consumer.ConsumerConfig consumerConfig)
For the @param consumerConfig, specify at least the "groupid" and "zookeeper.connect" string.
|
| Modifier and Type | Method and Description |
|---|---|
void |
cancel() |
void |
close() |
void |
commitCheckpoint(long checkpointId)
Notification on completed checkpoints
|
static long |
getOffset(org.I0Itec.zkclient.ZkClient zkClient,
String groupId,
String topic,
int partition) |
org.apache.flink.api.common.typeinfo.TypeInformation<OUT> |
getProducedType() |
void |
open(org.apache.flink.configuration.Configuration parameters) |
void |
restoreState(long[] state) |
void |
run(org.apache.flink.streaming.api.functions.source.SourceFunction.SourceContext<OUT> ctx) |
protected void |
setOffset(int partition,
long offset) |
static void |
setOffset(org.I0Itec.zkclient.ZkClient zkClient,
String groupId,
String topic,
int partition,
long offset)
This method's code is based on ZookeeperConsumerConnector.commitOffsetToZooKeeper()
|
long[] |
snapshotState(long checkpointId,
long checkpointTimestamp) |
public PersistentKafkaSource(String topicName, org.apache.flink.streaming.util.serialization.DeserializationSchema<OUT> deserializationSchema, kafka.consumer.ConsumerConfig consumerConfig)
public void open(org.apache.flink.configuration.Configuration parameters)
throws Exception
open in interface org.apache.flink.api.common.functions.RichFunctionopen in class org.apache.flink.api.common.functions.AbstractRichFunctionExceptionpublic void run(org.apache.flink.streaming.api.functions.source.SourceFunction.SourceContext<OUT> ctx) throws Exception
public void cancel()
cancel in interface org.apache.flink.streaming.api.functions.source.SourceFunction<OUT>public void close()
close in interface org.apache.flink.api.common.functions.RichFunctionclose in class org.apache.flink.api.common.functions.AbstractRichFunctionpublic long[] snapshotState(long checkpointId,
long checkpointTimestamp)
throws Exception
snapshotState in interface org.apache.flink.streaming.api.checkpoint.Checkpointed<long[]>Exceptionpublic void restoreState(long[] state)
restoreState in interface org.apache.flink.streaming.api.checkpoint.Checkpointed<long[]>public void commitCheckpoint(long checkpointId)
commitCheckpoint in interface org.apache.flink.streaming.api.checkpoint.CheckpointCommittercheckpointId - The ID of the checkpoint that has been completed.protected void setOffset(int partition,
long offset)
public static void setOffset(org.I0Itec.zkclient.ZkClient zkClient,
String groupId,
String topic,
int partition,
long offset)
public static long getOffset(org.I0Itec.zkclient.ZkClient zkClient,
String groupId,
String topic,
int partition)
Copyright © 2014–2015 The Apache Software Foundation. All rights reserved.