|
@ -27,23 +27,6 @@ public class Producer {
|
|
|
Logger logger = LoggerFactory.getLogger(Producer.class);
|
|
|
private static String topic = "sep-hbase-data";
|
|
|
|
|
|
public static void main(String[] args) {
|
|
|
try {
|
|
|
Yaml yaml = new Yaml();
|
|
|
URL url = Producer.class.getClassLoader().getResource("application.yml");
|
|
|
if (url != null) {
|
|
|
Map map =(Map)yaml.load(new FileInputStream(url.getFile()));
|
|
|
Map map2 = (Map)map.get("kafka");
|
|
|
Map map3 = (Map)map2.get("broker");
|
|
|
System.out.println(map3.get("address"));
|
|
|
//通过map我们取值就可以了.
|
|
|
}
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
public ProducerFactory<String, String> producerFactory() {
|
|
|
String kafkaBrokerAddress = "";
|
|
|
try {
|