Class PubSubSource<OUT>
- java.lang.Object
-
- org.apache.flink.api.common.functions.AbstractRichFunction
-
- org.apache.flink.streaming.api.functions.source.RichSourceFunction<OUT>
-
- org.apache.flink.streaming.connectors.gcp.pubsub.PubSubSource<OUT>
-
- All Implemented Interfaces:
Serializable,org.apache.flink.api.common.functions.Function,org.apache.flink.api.common.functions.RichFunction,org.apache.flink.api.common.state.CheckpointListener,org.apache.flink.api.java.typeutils.ResultTypeQueryable<OUT>,org.apache.flink.streaming.api.checkpoint.ListCheckpointed<AcknowledgeIdsForCheckpoint<String>>,org.apache.flink.streaming.api.functions.source.ParallelSourceFunction<OUT>,org.apache.flink.streaming.api.functions.source.SourceFunction<OUT>
public class PubSubSource<OUT> extends org.apache.flink.streaming.api.functions.source.RichSourceFunction<OUT> implements org.apache.flink.api.java.typeutils.ResultTypeQueryable<OUT>, org.apache.flink.streaming.api.functions.source.ParallelSourceFunction<OUT>, org.apache.flink.api.common.state.CheckpointListener, org.apache.flink.streaming.api.checkpoint.ListCheckpointed<AcknowledgeIdsForCheckpoint<String>>
PubSub Source, this Source will consume PubSub messages from a subscription and Acknowledge them on the next checkpoint. This ensures every message will get acknowledged at least once.- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classPubSubSource.DeserializationSchemaBuilderPart ofPubSubSource.PubSubSourceBuilderto set required fields.static interfacePubSubSource.ProjectNameBuilder<OUT>Part ofPubSubSource.PubSubSourceBuilderto set required fields.static classPubSubSource.PubSubSourceBuilder<OUT>Builder to create PubSubSource.static interfacePubSubSource.SubscriptionNameBuilder<OUT>Part ofPubSubSource.PubSubSourceBuilderto set required fields.-
Nested classes/interfaces inherited from interface org.apache.flink.streaming.api.functions.source.SourceFunction
org.apache.flink.streaming.api.functions.source.SourceFunction.SourceContext<T extends Object>
-
-
Field Summary
Fields Modifier and Type Field Description protected AcknowledgeOnCheckpoint<String>acknowledgeOnCheckpointprotected org.apache.flink.streaming.connectors.gcp.pubsub.PubSubSource.AcknowledgeOnCheckpointFactoryacknowledgeOnCheckpointFactoryprotected com.google.auth.Credentialscredentialsprotected PubSubDeserializationSchema<OUT>deserializationSchemaprotected booleanisRunningprotected intmessagePerSecondRateLimitprotected PubSubSubscriberFactorypubSubSubscriberFactoryprotected org.apache.flink.api.common.io.ratelimiting.FlinkConnectorRateLimiterrateLimiterprotected PubSubSubscribersubscriber
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcancel()voidclose()org.apache.flink.api.common.typeinfo.TypeInformation<OUT>getProducedType()static PubSubSource.DeserializationSchemaBuildernewBuilder()voidnotifyCheckpointAborted(long checkpointId)voidnotifyCheckpointComplete(long checkpointId)voidopen(org.apache.flink.configuration.Configuration configuration)voidrestoreState(List<AcknowledgeIdsForCheckpoint<String>> state)voidrun(org.apache.flink.streaming.api.functions.source.SourceFunction.SourceContext<OUT> sourceContext)List<AcknowledgeIdsForCheckpoint<String>>snapshotState(long checkpointId, long timestamp)
-
-
-
Field Detail
-
deserializationSchema
protected final PubSubDeserializationSchema<OUT> deserializationSchema
-
pubSubSubscriberFactory
protected final PubSubSubscriberFactory pubSubSubscriberFactory
-
credentials
protected final com.google.auth.Credentials credentials
-
acknowledgeOnCheckpointFactory
protected final org.apache.flink.streaming.connectors.gcp.pubsub.PubSubSource.AcknowledgeOnCheckpointFactory acknowledgeOnCheckpointFactory
-
rateLimiter
protected final org.apache.flink.api.common.io.ratelimiting.FlinkConnectorRateLimiter rateLimiter
-
messagePerSecondRateLimit
protected final int messagePerSecondRateLimit
-
acknowledgeOnCheckpoint
protected transient AcknowledgeOnCheckpoint<String> acknowledgeOnCheckpoint
-
subscriber
protected transient PubSubSubscriber subscriber
-
isRunning
protected transient volatile boolean isRunning
-
-
Method Detail
-
open
public void open(org.apache.flink.configuration.Configuration configuration) throws Exception- Specified by:
openin interfaceorg.apache.flink.api.common.functions.RichFunction- Overrides:
openin classorg.apache.flink.api.common.functions.AbstractRichFunction- Throws:
Exception
-
run
public void run(org.apache.flink.streaming.api.functions.source.SourceFunction.SourceContext<OUT> sourceContext) throws Exception
-
close
public void close() throws Exception- Specified by:
closein interfaceorg.apache.flink.api.common.functions.RichFunction- Overrides:
closein classorg.apache.flink.api.common.functions.AbstractRichFunction- Throws:
Exception
-
cancel
public void cancel()
- Specified by:
cancelin interfaceorg.apache.flink.streaming.api.functions.source.SourceFunction<OUT>
-
getProducedType
public org.apache.flink.api.common.typeinfo.TypeInformation<OUT> getProducedType()
- Specified by:
getProducedTypein interfaceorg.apache.flink.api.java.typeutils.ResultTypeQueryable<OUT>
-
newBuilder
public static PubSubSource.DeserializationSchemaBuilder newBuilder()
-
notifyCheckpointComplete
public void notifyCheckpointComplete(long checkpointId) throws Exception- Specified by:
notifyCheckpointCompletein interfaceorg.apache.flink.api.common.state.CheckpointListener- Throws:
Exception
-
notifyCheckpointAborted
public void notifyCheckpointAborted(long checkpointId)
- Specified by:
notifyCheckpointAbortedin interfaceorg.apache.flink.api.common.state.CheckpointListener
-
snapshotState
public List<AcknowledgeIdsForCheckpoint<String>> snapshotState(long checkpointId, long timestamp) throws Exception
-
-