Class PravegaSourceBuilder<T>
- java.lang.Object
-
- io.pravega.connectors.flink.AbstractReaderBuilder<B>
-
- io.pravega.connectors.flink.AbstractStreamingReaderBuilder<T,PravegaSourceBuilder<T>>
-
- io.pravega.connectors.flink.source.PravegaSourceBuilder<T>
-
- All Implemented Interfaces:
java.io.Serializable
@PublicEvolving public class PravegaSourceBuilder<T> extends AbstractStreamingReaderBuilder<T,PravegaSourceBuilder<T>>
The @builder class forPravegaSource
to make it easier for the users to construct aPravegaSource
.The following example shows the minimum setup to create a PravegaSource that reads the Integer values from a Pravega Stream.
PravegaSource<Integer> pravegaSource = PravegaSource.<Integer>builder() .forStream(streamName) .withPravegaConfig(pravegaConfig) .withReaderGroupName("flink-reader") .withDeserializationSchema(new IntegerDeserializationSchema()) .build();
The stream name, Pravega client configuration, the readerGroup name and the event deserialization schema are required fields that must be set.
Check the Java docs of each individual methods to learn more about the settings to build a PravegaSource.
- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class io.pravega.connectors.flink.AbstractStreamingReaderBuilder
AbstractStreamingReaderBuilder.ReaderGroupInfo
-
-
Field Summary
-
Fields inherited from class io.pravega.connectors.flink.AbstractStreamingReaderBuilder
checkpointInitiateTimeout, eventReadTimeout, maxOutstandingCheckpointRequest, readerGroupName, readerGroupRefreshTime, readerGroupScope, uid
-
-
Constructor Summary
Constructors Constructor Description PravegaSourceBuilder()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description PravegaSource<T>
build()
Builds aPravegaSource
based on the configuration.protected PravegaSourceBuilder<T>
builder()
protected org.apache.flink.util.SerializedValue<AssignerWithTimeWindows<T>>
getAssignerWithTimeWindows()
protected org.apache.flink.api.common.serialization.DeserializationSchema<T>
getDeserializationSchema()
PravegaSourceBuilder<T>
withDeserializationSchema(org.apache.flink.api.common.serialization.DeserializationSchema<T> deserializationSchema)
Sets the deserialization schema.PravegaSourceBuilder<T>
withTimestampAssigner(AssignerWithTimeWindows<T> assignerWithTimeWindows)
Sets the timestamp and watermark assigner.-
Methods inherited from class io.pravega.connectors.flink.AbstractStreamingReaderBuilder
buildReaderGroupInfo, buildSourceFunction, generateUid, uid, withCheckpointInitiateTimeout, withEventReadTimeout, withMaxOutstandingCheckpointRequest, withReaderGroupName, withReaderGroupRefreshTime, withReaderGroupScope
-
Methods inherited from class io.pravega.connectors.flink.AbstractReaderBuilder
enableMetrics, forStream, forStream, forStream, forStream, forStream, forStream, getPravegaConfig, isMetricsEnabled, resolveStreams, withPravegaConfig
-
-
-
-
Method Detail
-
builder
protected PravegaSourceBuilder<T> builder()
- Specified by:
builder
in classAbstractReaderBuilder<PravegaSourceBuilder<T>>
-
withDeserializationSchema
public PravegaSourceBuilder<T> withDeserializationSchema(org.apache.flink.api.common.serialization.DeserializationSchema<T> deserializationSchema)
Sets the deserialization schema.- Parameters:
deserializationSchema
- The deserialization schema- Returns:
- Builder instance.
-
withTimestampAssigner
public PravegaSourceBuilder<T> withTimestampAssigner(AssignerWithTimeWindows<T> assignerWithTimeWindows)
Sets the timestamp and watermark assigner.- Parameters:
assignerWithTimeWindows
- The timestamp and watermark assigner.- Returns:
- Builder instance.
-
getDeserializationSchema
protected org.apache.flink.api.common.serialization.DeserializationSchema<T> getDeserializationSchema()
- Specified by:
getDeserializationSchema
in classAbstractStreamingReaderBuilder<T,PravegaSourceBuilder<T>>
-
getAssignerWithTimeWindows
protected org.apache.flink.util.SerializedValue<AssignerWithTimeWindows<T>> getAssignerWithTimeWindows()
- Specified by:
getAssignerWithTimeWindows
in classAbstractStreamingReaderBuilder<T,PravegaSourceBuilder<T>>
-
build
public PravegaSource<T> build()
Builds aPravegaSource
based on the configuration.- Returns:
- an uninitialized reader as a source function.
- Throws:
java.lang.IllegalStateException
- if the configuration is invalid.
-
-