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
On a windows machine, you have to replace the `$PWD` with the current directory and the `$HOME` with a directory where you have the `.m2` folder.
58
+
At the subsequent prompt, create the topics & start a Kafka console consumer:
59
+
60
+
```shell
61
+
I have no name!@c07eea6aed61:/$ foritin input output;do kafka-topics.sh --create --bootstrap-server kafka:9092 --topic stream-$it;done
62
+
I have no name!@c07eea6aed61:/$ kafka-console-consumer.sh --bootstrap-server kafka:9092 --topic stream-output --from-beginning --property print.key=true
63
+
```
70
64
71
65
72
-
Now that our Kafka streaming application is running, it's time to feed it some input lines via the Kafka topic.
66
+
## Streaming Application
73
67
74
-
In yet another terminal, change into the lab's root directory again and this time, start a bash session in the _kafka_
75
-
container:
68
+
### Build the streaming app
69
+
70
+
Now that we have coded our app, we need to build it. Fortunately, we can use `docker` for this so that we don't have to
71
+
have `maven` and its prerequisites installed locally. Open a terminal in the lab's `wordcount-kafka-streaming` directory and issue
At the subsequent prompt, create the topics & start a Kafka console consumer:
78
+
On a windows machine, you have to replace the `$PWD` with the current directory and the `$HOME` with a directory where you have the `.m2` folder.
79
+
80
+
The command above will build and package our uber jar with the application and all of its dependencies.
81
+
82
+
### Start our streaming application
83
+
84
+
Now, let's start our streaming application connecting to Kafka running in our Docker environment:
82
85
83
86
```shell
84
-
I have no name!@c07eea6aed61:/$ foritin input output;do kafka-topics.sh --create --bootstrap-server kafka:9092 --topic stream-$it;done
85
-
I have no name!@c07eea6aed61:/$ kafka-console-consumer.sh --bootstrap-server kafka:9092 --topic stream-output --from-beginning --property print.key=true
0 commit comments