Skip to main content

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

flask_kafka_publisher-0.0.1.tar.gz (5.7 MB view details)

Uploaded Source

Built Distribution

flask_kafka_publisher-0.0.1-py3-none-any.whl (3.5 kB view details)

Uploaded Python 3

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

Hashes for flask_kafka_publisher-0.0.1.tar.gz
Algorithm Hash digest
SHA256 c7422e3e7c9e6f02b52f929b87eb42750835bba8c542d77f9e0b010aa8394c4d
MD5 1108643f682b96dc7d054f27fa0efa95
BLAKE2b-256 fc91fd3dfe4966bbd80a3f38d22327eb8c56490e12ceaf1fd18a1c0ea75df036

See more details on using hashes here.

File details

Details for the file flask_kafka_publisher-0.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for flask_kafka_publisher-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 cb054d3ff3ca60b1ef56f9c3566b67439118f4bc90f2181cee2ec1003b5f0aa4
MD5 7ee51012697de88e073730e6b2310666
BLAKE2b-256 623a28694defd6e72e55db2d0b2eb8a2e29ee29610328aa0236b7f06bf2c7d05

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page