A Flask extension that simplifies publishing messages to Kafka within your Flask application.
Project description
Flask-Kafka-Publisher
Flask-Kafka-Publisher is a Flask extension that simplifies publishing messages to Kafka within your Flask application. It provides an easy-to-use interface to send messages to Kafka topics directly from your business logic, making it a breeze to integrate Kafka into your Flask-based projects.
Features
- Seamless integration: Integrate Kafka message publishing directly into your Flask application without hassle.
- Simple configuration: Set up the Kafka connection and topic details with minimal configuration.
- Lightweight and efficient: The extension is designed to be lightweight and has minimal impact on your application's performance.
- Flexible message publishing: Send messages to Kafka from any part of your Flask application, including within your business logic.
Installation
You can install Flask-Kafka-Publisher using pip:
pip install flask_kafka_publisher
Usage
from flask import Flask, request
app = Flask(__name__)
app.config['KAFKA_HOST'] = 'localhost:9092'
kafka_publisher = KafkaPublisher()
kafka_publisher.init_app(app)
@app.route('/publish', methods=['POST'])
def publish_message():
message = request.json['message']
kafka_publisher.send('your_topic', message)
return 'Message published to Kafka!'
License
Flask Kafka Publisher is open source and released under the MIT License. Feel free to use, modify, and distribute it as per the terms of the license.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file flask_kafka_publisher-0.0.1.tar.gz
.
File metadata
- Download URL: flask_kafka_publisher-0.0.1.tar.gz
- Upload date:
- Size: 5.7 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c7422e3e7c9e6f02b52f929b87eb42750835bba8c542d77f9e0b010aa8394c4d |
|
MD5 | 1108643f682b96dc7d054f27fa0efa95 |
|
BLAKE2b-256 | fc91fd3dfe4966bbd80a3f38d22327eb8c56490e12ceaf1fd18a1c0ea75df036 |
File details
Details for the file flask_kafka_publisher-0.0.1-py3-none-any.whl
.
File metadata
- Download URL: flask_kafka_publisher-0.0.1-py3-none-any.whl
- Upload date:
- Size: 3.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | cb054d3ff3ca60b1ef56f9c3566b67439118f4bc90f2181cee2ec1003b5f0aa4 |
|
MD5 | 7ee51012697de88e073730e6b2310666 |
|
BLAKE2b-256 | 623a28694defd6e72e55db2d0b2eb8a2e29ee29610328aa0236b7f06bf2c7d05 |