Class PubSubSink
java.lang.Object
io.github.flink.gcp.connector.pubsub.sink.PubSubSink
Entry point for building a Pub/Sub sink.
The sink publishes records at-least-once through google-cloud-pubsub Publisher
instances, resolving the destination topic per record (dynamic destinations) and flushing all
outstanding publishes at every checkpoint barrier.
That at-least-once statement assumes the default FailureHandler.failJob() policy.
Under a dropping policy configured through PubSubSinkBuilder.failedMessageHandler(FailureHandler), a completed checkpoint means every
record up to the barrier was either published, skipped by the serializer, or handed to that
handler.
Example:
Sink<MyEvent> sink =
PubSubSink.<MyEvent>builder()
.destinationResolver(
(e, ctx) -> TopicDestination.of("my-project", e.topicName()))
.serializer(
PubSubSerializationSchema.payload(new MyEventSerializationSchema()))
.build();
-
Method Summary
Modifier and TypeMethodDescriptionstatic <T> PubSubSinkBuilder<T>builder()Creates a newPubSubSinkBuilder.
-
Method Details
-
builder
Creates a newPubSubSinkBuilder.- Type Parameters:
T- type of the records written by the sink- Returns:
- a new builder
-