mirror of https://github.com/apache/kafka.git
MINOR: add a space to separate two words
I think we should add a space here, otherwise the two words will join together. And replace the host string with a constant, otherwise when I need to modify the host, I need to modify several files. Author: 郑谦00117553 <00117553@zte.intra> Reviewers: Guozhang Wang <wangguoz@gmail.com> Closes #2132 from ZhengQian1/trunk
This commit is contained in:
parent
b902ef985a
commit
39a1c42dfc
|
@ -32,7 +32,7 @@ public class Consumer extends ShutdownableThread {
|
||||||
public Consumer(String topic) {
|
public Consumer(String topic) {
|
||||||
super("KafkaConsumerExample", false);
|
super("KafkaConsumerExample", false);
|
||||||
Properties props = new Properties();
|
Properties props = new Properties();
|
||||||
props.put(ConsumerConfig.BOOTSTRAP_SERVERS_CONFIG, "localhost:9092");
|
props.put(ConsumerConfig.BOOTSTRAP_SERVERS_CONFIG, KafkaProperties.KAFKA_SERVER_URL + ":" + KafkaProperties.KAFKA_SERVER_PORT);
|
||||||
props.put(ConsumerConfig.GROUP_ID_CONFIG, "DemoConsumer");
|
props.put(ConsumerConfig.GROUP_ID_CONFIG, "DemoConsumer");
|
||||||
props.put(ConsumerConfig.ENABLE_AUTO_COMMIT_CONFIG, "true");
|
props.put(ConsumerConfig.ENABLE_AUTO_COMMIT_CONFIG, "true");
|
||||||
props.put(ConsumerConfig.AUTO_COMMIT_INTERVAL_MS_CONFIG, "1000");
|
props.put(ConsumerConfig.AUTO_COMMIT_INTERVAL_MS_CONFIG, "1000");
|
||||||
|
|
|
@ -31,7 +31,7 @@ public class Producer extends Thread {
|
||||||
|
|
||||||
public Producer(String topic, Boolean isAsync) {
|
public Producer(String topic, Boolean isAsync) {
|
||||||
Properties props = new Properties();
|
Properties props = new Properties();
|
||||||
props.put("bootstrap.servers", "localhost:9092");
|
props.put("bootstrap.servers", KafkaProperties.KAFKA_SERVER_URL + ":" + KafkaProperties.KAFKA_SERVER_PORT);
|
||||||
props.put("client.id", "DemoProducer");
|
props.put("client.id", "DemoProducer");
|
||||||
props.put("key.serializer", "org.apache.kafka.common.serialization.IntegerSerializer");
|
props.put("key.serializer", "org.apache.kafka.common.serialization.IntegerSerializer");
|
||||||
props.put("value.serializer", "org.apache.kafka.common.serialization.StringSerializer");
|
props.put("value.serializer", "org.apache.kafka.common.serialization.StringSerializer");
|
||||||
|
|
Loading…
Reference in New Issue