Skip to content

A asynchronous Consumer and Producer API for Kafka with FastAPI in Python

License

Notifications You must be signed in to change notification settings

vinybrasil/fastapi_kafka

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

An asynchronous Consumer and Producer API for Kafka with FastAPI in Python

Create a simple asynchronous API that works the same time as a Kafka's producer and consumer with Python's FastAPI library. The entire explation of the projects can be found at my blog post.

To run Kafka:

> docker-compose -f docker-compose.yml up

Create a new topic:

> docker exec -ti kafka /opt/kafka/bin/kafka-topics.sh --create --zookeeper zookeeper:2181 --replication-factor 1 --partitions 1 --topic test1

Run the API:

> cd API
> uvicorn main:app --reload

Test it with cURL:

curl -X POST -d {\"name\":\"salve\"} -H "Content-Type: application/json"  https://localhost:8000/producer/test1

About

A asynchronous Consumer and Producer API for Kafka with FastAPI in Python

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages