package flink
- Alphabetic
- Public
- All
Type Members
-
sealed
trait
FlinkJobExecutor extends Serializable
Different strategy for execution of Flink jobs in local mode and in cluster
-
abstract
class
FlinkStreamlet extends Streamlet[FlinkStreamletContext] with Serializable
The base class for defining Flink streamlets.
The base class for defining Flink streamlets. Derived classes need to override
createLogic
to provide the custom implementation for the behavior of the streamlet.Here's an example:
// new custom `FlinkStreamlet` class MyFlinkProcessor extends FlinkStreamlet { // Step 1: Define inlets and outlets. Note for the outlet you can specify // the partitioner function explicitly or else `RoundRobinPartitioner` // will be used val in = AvroInlet[Data]("in") val out = AvroOutlet[Simple]("out", _.name) // Step 2: Define the shape of the streamlet. In this example the streamlet // has 1 inlet and 1 outlet val shape = StreamletShape(in, out) // Step 3: Provide custom implementation of `FlinkStreamletLogic` that defines // the behavior of the streamlet override def createLogic() = new FlinkStreamletLogic { override def executeStreamingQueries = { val outStream: DataStream[Simple] = writeStream( readStream(in).map(r => Simple(r.name)), out ) executionEnv.execute() } } }
-
abstract
case class
FlinkStreamletContext(streamletDefinition: StreamletDefinition, env: StreamExecutionEnvironment) extends StreamletContext with Product with Serializable
Runtime context for FlinkStreamlets
Runtime context for FlinkStreamlets
The
FlinkStreamletContext
provides the necessary context under which a streamlet runs. It contains the following context data and contracts:- An active
StreamExecutionEnvironment
that will be used to submit streaming jobs to the Flink runtime. - The Typesafe
Config
loaded from the classpath through aconfig
method, which can be used to read configuration settings. - The name used in the blueprint for the specific instance of this streamlet being run.
- A mapping that gives the name of the Kafka topic from the port name.
- An active
-
class
FlinkStreamletContextImpl extends FlinkStreamletContext
An implementation of
FlinkStreamletContext
-
abstract
class
FlinkStreamletLogic extends StreamletLogic[FlinkStreamletContext]
The
FlinkStreamletLogic
provides methods to read and write data streams, and provides access to the configuration of the streamlet, among other things.The
FlinkStreamletLogic
provides methods to read and write data streams, and provides access to the configuration of the streamlet, among other things. AFlinkStreamletLogic
must provide a method for executing streaming queries that process the Flink computation graph. The methodbuildExecutionGraph
has to be overridden by implementation classes that process one or moreDataStream
{empty}s. The resulting graph is then submitted byexecuteStreamingQueries
to the Flink runtimeStreamExecutionEnvironment
to generate the final output. These jobs will be run by therun
method ofFlinkStreamlet
to produce aStreamletExecution
class, theStreamletExecution
class manages the execution of a Flink Job. TheFlinkStreamletLogic
may contain instance values since it's only constructed in runtime. TheStreamlet
, however, is also instantiated during compile-time, to extract metadata, and must not contain any instance values.Overide the method
buildExecutionGraph
to build the computation graph that needs to run as part of the business logic for theFlinkStreamlet
.Here's an example of how to provide a specialized implementation of
FlinkStreamletLogic
as part of implementing a customFlinkStreamlet
:// new custom `FlinkStreamlet` // define inlets, outlets and shape // provide custom implementation of `FlinkStreamletLogic` override def createLogic() = new FlinkStreamletLogic { override def buildExecutionGraph = { val ins: DataStream[Data] = readStream(in) val simples: DataStream[Simple] = ins.map(r => new Simple(r.getName())) writeStream(out, simples) } } }
Value Members
-
object
ClusterFlinkJobExecutor extends FlinkJobExecutor
Execution in blocking mode.
- object FlinkStreamletRuntime extends StreamletRuntime with Product with Serializable
-
object
LocalFlinkJobExecutor extends FlinkJobExecutor
Future based execution of Flink jobs on the sandbox