You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: kafka-quickstart/README.md
+21-13
Original file line number
Diff line number
Diff line change
@@ -20,9 +20,9 @@ and in another terminal:
20
20
mvn -f processor quarkus:dev
21
21
```
22
22
23
-
_NOTE_: Quarkus Dev Services starts a Kafka broker for you automatically.
23
+
_NOTE_: Quarkus Dev Services starts a Kafka broker for you automatically.
24
24
25
-
Then, open your browser to`http://localhost:8080/quotes.html`.
25
+
Then, open your browser at`http://localhost:8080/quotes.html`.
26
26
You can send quote requests and observe received quotes.
27
27
28
28
## Anatomy
@@ -31,7 +31,7 @@ The application is composed of the following components:
31
31
32
32
#### Producer
33
33
34
-
The _producer_ application receive requests from the user (via HTTP) and sends data to the Kafka broker.
34
+
The _producer_ application receive requests from the user (via HTTP) and sends _quote requests_ to the Kafka broker.
35
35
Two main components compose the application:
36
36
37
37
*`QuoteProducer` generates uniquely identified quote requests and sends them to the Kafka topic `quote-requests`.
@@ -40,26 +40,25 @@ It also consumes the Kafka topic `quotes` and relays received messages to the br
40
40
41
41
#### Processor
42
42
43
-
The _processor_ application receives data from Kafka, processes them, and writes the result into the `quotes` Kafka topic.
43
+
The _processor_ application receives quote requests from Kafka, processes them, and writes results into the `quotes` Kafka topic.
44
+
The application has one main class:
44
45
45
-
Two main classes compose the application:
46
-
47
-
*`QuoteProcessor` consumes quote request id's from the `quote-requests` Kafka topic and responds back to the `quotes` topic with a `Quote` object containing a random price.
46
+
*`QuoteProcessor` consumes quote request ids from the `quote-requests` Kafka topic and responds back to the `quotes` topic with a `Quote` object containing a random price.
48
47
49
48
The connection to Kafka is configured in the `src/main/resources/application.properties` file.
50
49
51
50
## Running the application in Docker
52
51
53
-
To run the application on Docker:
52
+
To run the application in Docker, first make sure that both services are built:
54
53
55
-
First make sure that both services are packaged:
56
54
```bash
57
55
mvn package
58
56
```
59
57
60
-
Then launch the Docker compose:
58
+
Then launch Docker Compose:
59
+
61
60
```bash
62
-
dockercompose up
61
+
docker-compose up
63
62
```
64
63
65
64
This will create a single-node Kafka cluster and launch both applications.
@@ -69,10 +68,19 @@ This will create a single-node Kafka cluster and launch both applications.
69
68
You can compile the application into a native binary using:
70
69
71
70
```bash
72
-
./mvn package -Pnative
71
+
mvn package -Dnative
72
+
```
73
+
74
+
As you are running in _prod_ mode, you need a Kafka cluster.
75
+
76
+
If you have Docker installed, you can simply run:
77
+
78
+
```bash
79
+
export QUARKUS_MODE=native
80
+
docker-compose up --build
73
81
```
74
82
75
-
As you are running in _prod_ mode, you need a Kafka cluster. You can follow the instructions from the [Apache Kafka web site](https://kafka.apache.org/quickstart) or run `docker-compose up` if you have docker installed on your machine.
83
+
Alternatively, you can follow the instructions from the [Apache Kafka web site](https://kafka.apache.org/quickstart).
0 commit comments