August 2017
Beginner to intermediate
278 pages
6h 40m
English
We will be reusing the producer code from the previous chapter.
streaming.properties file:
topic=iprecordbroker.list=10.200.99.197:6667appname=IpFraudgroup.id=Stream
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 e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } } public String getPropertyValue(String key) { return this.prop.getProperty(key); }}
Read now
Unlock full access