Update README.md
This commit is contained in:
Родитель
a8c7bb3820
Коммит
63f08d9192
|
@ -56,6 +56,8 @@ sasl.jaas.config=org.apache.kafka.common.security.plain.PlainLoginModule require
|
|||
|
||||
### Run producer from command line
|
||||
|
||||
This sample is configured to send messages to topic `test`, if you would like to change the topic, change the TOPIC constant in `producer/src/main/java/com/example/app/TestProducer.java`.
|
||||
|
||||
To run the producer from the command line, generate the JAR and then run from within Maven (alternatively, generate the JAR using Maven, then run in Java by adding the necessary Kafka JAR(s) to the classpath):
|
||||
|
||||
```bash
|
||||
|
@ -63,7 +65,7 @@ mvn clean package
|
|||
mvn exec:java -Dexec.mainClass="TestProducer"
|
||||
```
|
||||
|
||||
The producer will now begin sending events to the Kafka-enabled Event Hub at topic `test` and printing the events to stdout. If you would like to change the topic, change the TOPIC constant in `producer/src/main/java/com/example/app/TestProducer.java`.
|
||||
The producer will now begin sending events to the Kafka-enabled Event Hub at topic `test` (or whatever topic you chose) and printing the events to stdout.
|
||||
|
||||
## Consumer
|
||||
|
||||
|
@ -84,6 +86,8 @@ sasl.jaas.config=org.apache.kafka.common.security.plain.PlainLoginModule require
|
|||
|
||||
### Run consumer from command line
|
||||
|
||||
This sample is configured to receive messages from topic `test`, if you would like to change the topic, change the TOPIC constant in `consumer/src/main/java/com/example/app/TestConsumer.java`.
|
||||
|
||||
To run the producer from the command line, generate the JAR and then run from within Maven (alternatively, generate the JAR using Maven, then run in Java by adding the necessary Kafka JAR(s) to the classpath):
|
||||
|
||||
```bash
|
||||
|
@ -91,6 +95,6 @@ mvn clean package
|
|||
mvn exec:java -Dexec.mainClass="TestConsumer"
|
||||
```
|
||||
|
||||
If the Kafka-enabled Event Hub has incoming events (for instance, if your example producer is also running), then the consumer should now begin receiving events from topic `test`. If you would like to change the topic, change the TOPIC constant in `producer/src/main/java/com/example/app/TestConsumer.java`.
|
||||
If the Kafka-enabled Event Hub has incoming events (for instance, if your example producer is also running), then the consumer should now begin receiving events from topic `test` (or whatever topic you chose).
|
||||
|
||||
By default, Kafka consumers will read from the end of the stream rather than the beginning. This means any events queued before you begin running your consumer will not be read. If you started your consumer but it isn't receiving any events, try running your producer again while your consumer is polling. Alternatively, you can use Kafka's [`auto.offset.reset` consumer config](https://kafka.apache.org/documentation/#newconsumerconfigs) to make your consumer read from the beginning of the stream!
|
||||
|
|
Загрузка…
Ссылка в новой задаче