https://github.com/byhbt/phoenix-kafka-sample
Sample Phoenix Application produce message to Kafka
https://github.com/byhbt/phoenix-kafka-sample
kafka-producer phoenix-framework
Last synced: about 1 month ago
JSON representation
Sample Phoenix Application produce message to Kafka
- Host: GitHub
- URL: https://github.com/byhbt/phoenix-kafka-sample
- Owner: byhbt
- Created: 2021-07-25T07:55:21.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2021-07-25T12:18:45.000Z (about 4 years ago)
- Last Synced: 2025-03-13T19:15:43.626Z (7 months ago)
- Topics: kafka-producer, phoenix-framework
- Language: Elixir
- Homepage:
- Size: 207 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Introduction
This is a sample Phoenix Application for demo connecting to Kafka. To see it in action, you can checkout the video here: https://youtu.be/Xwl0MKCnL_Y
## Features
- Setup local development environment using Docker Compose.
- [Kowl](https://github.com/cloudhut/kowl) explore Kafka messages.
- [Kaffe](https://github.com/spreedly/kaffe) Kafka client library for Phoenix projects.## Up and running
Just run docker-compose up.
```bash
docker compose up
```## Some useful command:
**Create a topic**
```bash
docker compose exec kafka \
kafka-topics --create --topic emails --partitions 1 --replication-factor 1 --if-not-exists --zookeeper zookeeper:2181
```Or create multiple topics:
```bash
docker-compose exec kafka \
bash -c "seq 42 | kafka-console-producer --request-required-acks 1 --broker-list localhost:29092 --topic foo && echo 'Produced 42 messages.'"
```**Describe topic**
```bash
docker compose exec kafka \
kafka-topics --describe --topic foo --zookeeper zookeeper:2181
```**List messages in the topic**
```bash
docker compose exec kafka kafka-console-consumer --bootstrap-server localhost:29092 --topic emails --from-beginning
```