August 2017
Beginner to intermediate
278 pages
6h 40m
English
We preferred to use a property file for some important values such as topic, Kafka broker URL, and so on. If you want to read more values from the property file, then feel free to change it in the code. streaming.properties file:
topic=ipTest2broker.list=10.200.99.197:6667appname=IpFraudgroup.id=Stream
The following is an example of the property reader:
import java.io.FileNotFoundException;import java.io.IOException;import java.io.InputStream;import java.util.Properties;public class PropertyReader { private Properties prop = null; public PropertyReader() { InputStream is = null; try { this.prop = new Properties(); is = this.getClass().getResourceAsStream("/streaming.properties"); prop.load(is); } catch (FileNotFoundException ...
Read now
Unlock full access