IN - The type of the input elements.@Internal public class PulsarWriter<IN> extends Object implements org.apache.flink.api.connector.sink2.TwoPhaseCommittingSink.PrecommittingSinkWriter<IN,PulsarCommittable>
DeliveryGuarantees.| Constructor and Description |
|---|
PulsarWriter(SinkConfiguration sinkConfiguration,
PulsarSerializationSchema<IN> serializationSchema,
TopicRegister<IN> topicRegister,
TopicRouter<IN> topicRouter,
MessageDelayer<IN> messageDelayer,
org.apache.pulsar.client.api.CryptoKeyReader cryptoKeyReader,
org.apache.flink.api.connector.sink2.Sink.InitContext initContext)
Constructor creating a Pulsar writer.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
void |
flush(boolean endOfInput) |
Collection<PulsarCommittable> |
prepareCommit() |
void |
write(IN element,
org.apache.flink.api.connector.sink2.SinkWriter.Context context) |
public PulsarWriter(SinkConfiguration sinkConfiguration, PulsarSerializationSchema<IN> serializationSchema, TopicRegister<IN> topicRegister, TopicRouter<IN> topicRouter, MessageDelayer<IN> messageDelayer, @Nullable org.apache.pulsar.client.api.CryptoKeyReader cryptoKeyReader, org.apache.flink.api.connector.sink2.Sink.InitContext initContext)
It will throw a RuntimeException if PulsarSerializationSchema#open(InitializationContext, PulsarSinkContext, SinkConfiguration)
fails.
sinkConfiguration - The configuration to configure the Pulsar producer.serializationSchema - Transform the incoming records into different message properties.topicRegister - The listener for querying topic metadata.topicRouter - Topic router to choose topic by incoming records.initContext - Context to provide information about the runtime environment.public void write(IN element, org.apache.flink.api.connector.sink2.SinkWriter.Context context) throws IOException, InterruptedException
write in interface org.apache.flink.api.connector.sink2.SinkWriter<IN>IOExceptionInterruptedExceptionpublic void flush(boolean endOfInput)
throws IOException
flush in interface org.apache.flink.api.connector.sink2.SinkWriter<IN>IOExceptionpublic Collection<PulsarCommittable> prepareCommit()
prepareCommit in interface org.apache.flink.api.connector.sink2.TwoPhaseCommittingSink.PrecommittingSinkWriter<IN,PulsarCommittable>public void close()
throws Exception
close in interface AutoCloseableExceptionCopyright © 2014–2022 The Apache Software Foundation. All rights reserved.