Minor cleanup in samples and tools

- Cleanup in schema-registry samples (final variable).
- Add instructions in tools/kafka/docker-compose to run
  a quick test using Kafka console scripts.
This commit is contained in:
Soby Chacko
2022-10-20 15:00:29 -04:00
parent 9fa26da9ca
commit aebd885204
3 changed files with 22 additions and 2 deletions

View File

@@ -35,7 +35,7 @@ import org.springframework.web.bind.annotation.RestController;
@RestController
public class Producer1ApplicationKafka {
private Random random = new Random();
private final Random random = new Random();
@Autowired
private StreamBridge streamBridge;

View File

@@ -41,7 +41,7 @@ import com.example.Sensor;
@RestController
public class Producer2ApplicationKafka {
private Random random = new Random();
private final Random random = new Random();
@Autowired
private StreamBridge streamBridge;

View File

@@ -17,6 +17,26 @@ docker-compose -f ./kafka-cluster.yml down
TIP: To start the containers in the foreground simply add `-d` to the start command. To stop containers that are running in the foreground simple issue `CTRL-C` command.
Running a quick test:
Now that we started our clusters, let us try to produce data to a topic on the cluster and then consume from it.
To produce data to a topic named `input-topic`:
```
docker exec -it broker1 /bin/kafka-console-producer --bootstrap-server localhost:29091 --topic input-topic
```
Note the use of bootstrap-server at `localhost:29091`.
This port is internal to the docker container.
To consume from the `input-topic`:
```
docker exec -it broker1 /bin/kafka-console-consumer --bootstrap-server localhost:29091 --topic input-topic
```
Enter some data on the producer console and hit enter, you should see the same data gets echoed on the consumer console.
=== Control Center UI
Runs a https://docs.confluent.io/platform/current/control-center/index.html[Confluent Control Center] that exposes a UI at http://locahost:9021.