Book Image

Learning Apache Flink

By : Tanmay Deshpande
Book Image

Learning Apache Flink

By: Tanmay Deshpande

Overview of this book

<p>With the advent of massive computer systems, organizations in different domains generate large amounts of data on a real-time basis. The latest entrant to big data processing, Apache Flink, is designed to process continuous streams of data at a lightning fast pace.</p> <p>This book will be your definitive guide to batch and stream data processing with Apache Flink. The book begins with introducing the Apache Flink ecosystem, setting it up and using the DataSet and DataStream API for processing batch and streaming datasets. Bringing the power of SQL to Flink, this book will then explore the Table API for querying and manipulating data. In the latter half of the book, readers will get to learn the remaining ecosystem of Apache Flink to achieve complex tasks such as event processing, machine learning, and graph processing. The final part of the book would consist of topics such as scaling Flink solutions, performance optimization and integrating Flink with other tools such as ElasticSearch.</p> <p>Whether you want to dive deeper into Apache Flink, or want to investigate how to get more out of this powerful technology, you’ll find everything you need inside.</p>
Table of Contents (17 chapters)
Learning Apache Flink
About the Author
About the Reviewers
Customer Feedback

Using ParameterTool

Since Flink 0.9, we have a built-in ParameterTool in Flink, which helps to get parameters from external sources such as arguments, system properties, or from property files. Internally, it is a map of strings which keeps the key as the parameter name and the value as the parameter value.

For example, we can think of using ParameterTool in our DataStream API example, where we need to set Kafka properties:

String kafkaproperties = "/path/to/";
ParameterTool parameter = ParameterTool.fromPropertiesFile(propertiesFile);

From system properties

We can read properties defined in system variables. We need to pass the system properties file before initializing them by setting Dinput=hdfs://myfile.

Now we can read all those properties in ParameterTool as follows:

ParameterTool parameters = ParameterTool.fromSystemProperties(); 

From command line arguments

We can also read the parameters from command line arguments. We have to set --elements before invoking the...