Package io.pravega.connectors.flink
Class AbstractStreamingWriterBuilder<T,B extends AbstractStreamingWriterBuilder>
- java.lang.Object
-
- io.pravega.connectors.flink.AbstractWriterBuilder<B>
-
- io.pravega.connectors.flink.AbstractStreamingWriterBuilder<T,B>
-
- Type Parameters:
T
- the element type.B
- the builder type.
- All Implemented Interfaces:
java.io.Serializable
- Direct Known Subclasses:
FlinkPravegaWriter.Builder
@Internal public abstract class AbstractStreamingWriterBuilder<T,B extends AbstractStreamingWriterBuilder> extends AbstractWriterBuilder<B>
An abstract streaming writer builder. The builder is abstracted to act as the base for theFlinkPravegaWriter
builder.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected static long
DEFAULT_TXN_LEASE_RENEWAL_PERIOD_MILLIS
boolean
enableWatermark
org.apache.flink.api.common.time.Time
txnLeaseRenewalPeriod
PravegaWriterMode
writerMode
-
Constructor Summary
Constructors Modifier Constructor Description protected
AbstractStreamingWriterBuilder()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected FlinkPravegaWriter<T>
createSinkFunction(org.apache.flink.api.common.serialization.SerializationSchema<T> serializationSchema, PravegaEventRouter<T> eventRouter)
Creates the sink function for the current builder state.B
enableWatermark(boolean enableWatermark)
Enable watermark.B
withTxnLeaseRenewalPeriod(org.apache.flink.api.common.time.Time period)
Sets the transaction lease renewal period.B
withWriterMode(PravegaWriterMode writerMode)
Sets the writer mode to provide at-least-once or exactly-once guarantees.-
Methods inherited from class io.pravega.connectors.flink.AbstractWriterBuilder
builder, enableMetrics, forStream, forStream, getPravegaConfig, isMetricsEnabled, resolveStream, withPravegaConfig
-
-
-
-
Field Detail
-
DEFAULT_TXN_LEASE_RENEWAL_PERIOD_MILLIS
protected static final long DEFAULT_TXN_LEASE_RENEWAL_PERIOD_MILLIS
- See Also:
- Constant Field Values
-
writerMode
public PravegaWriterMode writerMode
-
enableWatermark
public boolean enableWatermark
-
txnLeaseRenewalPeriod
public org.apache.flink.api.common.time.Time txnLeaseRenewalPeriod
-
-
Method Detail
-
withWriterMode
public B withWriterMode(PravegaWriterMode writerMode)
Sets the writer mode to provide at-least-once or exactly-once guarantees.- Parameters:
writerMode
- The writer mode ofBEST_EFFORT
,ATLEAST_ONCE
, orEXACTLY_ONCE
.- Returns:
- A builder to configure and create a streaming writer.
-
enableWatermark
public B enableWatermark(boolean enableWatermark)
Enable watermark.- Parameters:
enableWatermark
- boolean- Returns:
- A builder to configure and create a streaming writer.
-
withTxnLeaseRenewalPeriod
public B withTxnLeaseRenewalPeriod(org.apache.flink.api.common.time.Time period)
Sets the transaction lease renewal period. When the writer mode is set toEXACTLY_ONCE
, transactions are used to persist events to the Pravega stream. The transaction interval corresponds to the Flink checkpoint interval. Throughout that interval, the transaction is kept alive with a lease that is periodically renewed. This configuration setting sets the lease renewal period. The default value is 30 seconds.- Parameters:
period
- the lease renewal period- Returns:
- A builder to configure and create a streaming writer.
-
createSinkFunction
protected FlinkPravegaWriter<T> createSinkFunction(org.apache.flink.api.common.serialization.SerializationSchema<T> serializationSchema, PravegaEventRouter<T> eventRouter)
Creates the sink function for the current builder state.- Parameters:
serializationSchema
- the deserialization schema to use.eventRouter
- the event router to use.- Returns:
- An instance of
FlinkPravegaWriter
.
-
-