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
createLogicto 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
FlinkStreamletContextprovides the necessary context under which a streamlet runs. It contains the following context data and contracts:- An active
StreamExecutionEnvironmentthat will be used to submit streaming jobs to the Flink runtime. - The Typesafe
Configloaded from the classpath through aconfigmethod, 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
FlinkStreamletLogicprovides methods to read and write data streams, and provides access to the configuration of the streamlet, among other things.The
FlinkStreamletLogicprovides methods to read and write data streams, and provides access to the configuration of the streamlet, among other things. AFlinkStreamletLogicmust provide a method for executing streaming queries that process the Flink computation graph. The methodbuildExecutionGraphhas to be overridden by implementation classes that process one or moreDataStream{empty}s. The resulting graph is then submitted byexecuteStreamingQueriesto the Flink runtimeStreamExecutionEnvironmentto generate the final output. These jobs will be run by therunmethod ofFlinkStreamletto produce aStreamletExecutionclass, theStreamletExecutionclass manages the execution of a Flink Job. TheFlinkStreamletLogicmay 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
buildExecutionGraphto 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
FlinkStreamletLogicas 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