Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jeantessier/micronaut-kafka-test
A simple test of the `micronaut-kafka` integration
https://github.com/jeantessier/micronaut-kafka-test
Last synced: about 2 months ago
JSON representation
A simple test of the `micronaut-kafka` integration
- Host: GitHub
- URL: https://github.com/jeantessier/micronaut-kafka-test
- Owner: jeantessier
- Created: 2021-02-20T05:22:14.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2024-11-17T23:49:43.000Z (about 2 months ago)
- Last Synced: 2024-11-18T00:32:47.420Z (about 2 months ago)
- Language: Groovy
- Size: 351 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Micronaut - Kafka Test
This is a simple test of the `micronaut-kafka` integration.
It has a simple producer that writes to a topic. It has a simple consumer that
reads from this topic.Inspired by [this Micronaut presentation](https://youtu.be/6jL1RPdVm2w).
## To Run
You can start Kafka with Docker Compose:
$ docker compose up -d
You can start the message producer with the following command:
$ (cd producer-app && ./gradlew run)
You can start one or more message consumers with the following command:
$ (cd consumer-app && ./gradlew run)
Just hit Ctrl-C in each shell to stop it when you're done. You can stop Kafka
with `docker compose stop`.## To Trigger a Message
$ http :8080/hello/event
or
$ http :8080/hello/string
## To Trigger a Message With a Parameter
$ http :8080/hello/event name=="Jean Tessier"
or
$ http :8080/hello/string name=="Jean Tessier"
## Topics
The application will automatically create the `micronaut.kafka.test.events` and
`micronaut.kafka.test.strings` topics, but with a single partition. This means
that no matter how many consumers you start, all messages will go to only one of
them (usually the last one to start).You can add partitions with:
$ docker compose exec kafka \
/opt/bitnami/kafka/bin/kafka-topics.sh \
--bootstrap-server kafka:9092 \
--alter \
--topic micronaut.kafka.test.events \
--partitions 5