Package io.pravega.connectors.flink
Class FlinkPravegaInputFormat<T>
- java.lang.Object
-
- org.apache.flink.api.common.io.RichInputFormat<T,PravegaInputSplit>
-
- io.pravega.connectors.flink.FlinkPravegaInputFormat<T>
-
- All Implemented Interfaces:
java.io.Serializable
,org.apache.flink.api.common.io.InputFormat<T,PravegaInputSplit>
,org.apache.flink.core.io.InputSplitSource<PravegaInputSplit>
public class FlinkPravegaInputFormat<T> extends org.apache.flink.api.common.io.RichInputFormat<T,PravegaInputSplit>
A FlinkInputFormat
that can be added as a source to read from Pravega in a Flink batch job.- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
FlinkPravegaInputFormat.Builder<T>
A builder forFlinkPravegaInputFormat
to read Pravega streams using the Flink batch API.
-
Constructor Summary
Constructors Constructor Description FlinkPravegaInputFormat(io.pravega.client.ClientConfig clientConfig, java.util.List<StreamWithBoundaries> streams, org.apache.flink.api.common.serialization.DeserializationSchema<T> deserializationSchema)
Creates a new Flink PravegaInputFormat
which can be added as a source to a Flink batch job.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static <T> FlinkPravegaInputFormat.Builder<T>
builder()
Gets a builderFlinkPravegaInputFormat
to read Pravega streams using the Flink batch API.void
close()
void
closeInputFormat()
void
configure(org.apache.flink.configuration.Configuration parameters)
PravegaInputSplit[]
createInputSplits(int minNumSplits)
protected io.pravega.client.BatchClientFactory
getBatchClientFactory(java.lang.String clientScope, io.pravega.client.ClientConfig clientConfig)
org.apache.flink.core.io.InputSplitAssigner
getInputSplitAssigner(PravegaInputSplit[] inputSplits)
org.apache.flink.api.common.io.statistics.BaseStatistics
getStatistics(org.apache.flink.api.common.io.statistics.BaseStatistics cachedStatistics)
T
nextRecord(T t)
void
open(PravegaInputSplit split)
void
openInputFormat()
boolean
reachedEnd()
-
-
-
Constructor Detail
-
FlinkPravegaInputFormat
public FlinkPravegaInputFormat(io.pravega.client.ClientConfig clientConfig, java.util.List<StreamWithBoundaries> streams, org.apache.flink.api.common.serialization.DeserializationSchema<T> deserializationSchema)
Creates a new Flink PravegaInputFormat
which can be added as a source to a Flink batch job.- Parameters:
clientConfig
- The pravega client configuration.streams
- The list of streams to read events from.deserializationSchema
- The implementation to deserialize events from pravega streams.
-
-
Method Detail
-
openInputFormat
public void openInputFormat() throws java.io.IOException
- Overrides:
openInputFormat
in classorg.apache.flink.api.common.io.RichInputFormat<T,PravegaInputSplit>
- Throws:
java.io.IOException
-
getBatchClientFactory
@VisibleForTesting protected io.pravega.client.BatchClientFactory getBatchClientFactory(java.lang.String clientScope, io.pravega.client.ClientConfig clientConfig)
-
closeInputFormat
public void closeInputFormat() throws java.io.IOException
- Overrides:
closeInputFormat
in classorg.apache.flink.api.common.io.RichInputFormat<T,PravegaInputSplit>
- Throws:
java.io.IOException
-
configure
public void configure(org.apache.flink.configuration.Configuration parameters)
-
getStatistics
public org.apache.flink.api.common.io.statistics.BaseStatistics getStatistics(org.apache.flink.api.common.io.statistics.BaseStatistics cachedStatistics) throws java.io.IOException
- Throws:
java.io.IOException
-
createInputSplits
public PravegaInputSplit[] createInputSplits(int minNumSplits) throws java.io.IOException
- Throws:
java.io.IOException
-
getInputSplitAssigner
public org.apache.flink.core.io.InputSplitAssigner getInputSplitAssigner(PravegaInputSplit[] inputSplits)
-
open
public void open(PravegaInputSplit split) throws java.io.IOException
- Throws:
java.io.IOException
-
reachedEnd
public boolean reachedEnd() throws java.io.IOException
- Throws:
java.io.IOException
-
close
public void close() throws java.io.IOException
- Throws:
java.io.IOException
-
builder
public static <T> FlinkPravegaInputFormat.Builder<T> builder()
Gets a builderFlinkPravegaInputFormat
to read Pravega streams using the Flink batch API.- Type Parameters:
T
- the element type.- Returns:
- A builder to configure and create a batch reader.
-
-