{ "info": { "author": "Nimrod Kevin Maina", "author_email": "nimzy.maina@gmail.com", "bugtrack_url": null, "classifiers": [], "description": "# Flask Kafka\n\nThis is an easy to use utility to help Flask developers to implement microservices that interact with Kafka. This library has been inspired by two other similar libraries :-\n\n- [`Flask RabbitMQ`](https://github.com/pushyzheng/flask-rabbitmq) \n- [`Kakfaesque`](https://github.com/sankalpjonn/kafkaesque)\n\nAfter looking around the web and on Github, I was not able to find a lot of content on how to consume from a Kafka topic using the Kafka framework. From what I found, I was able to come up with this library by borrowing from the above libraries. They both had a little of what I wanted so I combined them to come up with this one.\n\nI hope you find this useful.\n\n## Features\n\n- Doesn't block process\n- Configure by `config.py`\n- Support comsuming from topic by decorator \n\n## Installation\n\nThis project has been commited to Pypi, can be installed by pip:\n```shell\n$ pip install flask-kafka\n```\n\n## Simple example\n\n```python\nfrom flask import Flask\nfrom threading import Event\nimport signal\n\nfrom flask_kafka import FlaskKafka\napp = Flask(__name__)\n\nINTERRUPT_EVENT = Event()\n\nbus = FlaskKafka(INTERRUPT_EVENT,\n bootstrap_servers=\",\".join([\"localhost:9092\"]),\n group_id=\"consumer-grp-id\"\n )\n\n\ndef listen_kill_server():\n signal.signal(signal.SIGTERM, bus.interrupted_process)\n signal.signal(signal.SIGINT, bus.interrupted_process)\n signal.signal(signal.SIGQUIT, bus.interrupted_process)\n signal.signal(signal.SIGHUP, bus.interrupted_process)\n\n\n@bus.handle('test-topic')\ndef test_topic_handler(msg):\n print(\"consumed {} from test-topic\".format(msg))\n\n\nif __name__ == '__main__':\n bus.run()\n listen_kill_server()\n app.run(debug=True, port=5004)\n\n```\n\n\n## License\n\n```\nMIT License\n\nCopyright (c) 2019 Nimrod Kevin Maina\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n```\n\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/nimzymaina/flask_kafka", "keywords": "kafka,consumer,kafkaesque,flask,simple,consumer,flask style,decorator", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "flask-kafka", "package_url": "https://pypi.org/project/flask-kafka/", "platform": "", "project_url": "https://pypi.org/project/flask-kafka/", "project_urls": { "Homepage": "https://github.com/nimzymaina/flask_kafka" }, "release_url": "https://pypi.org/project/flask-kafka/0.0.2/", "requires_dist": [ "kafka-python" ], "requires_python": "", "summary": "An easy to use kafka consumer that uses the kafka-python library, it runs concurently with your flask server", "version": "0.0.2" }, "last_serial": 5815353, "releases": { "0.0.1": [ { "comment_text": "", "digests": { "md5": "9b336404e8edb5b1eb5e0f50b5532fc5", "sha256": "df9b8db88b648125809483dbfbb74390d67ca004763af938d24236ad305e6945" }, "downloads": -1, "filename": "flask_kafka-0.0.1-py3-none-any.whl", "has_sig": false, "md5_digest": "9b336404e8edb5b1eb5e0f50b5532fc5", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 3455, "upload_time": "2019-09-11T14:38:12", "url": "https://files.pythonhosted.org/packages/62/b1/8d2f475c620fc58ad32c03c03adc68380b618b1691dbf2633032eb474cf6/flask_kafka-0.0.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "2aacdf3bdf42920a1931036ba2ebac71", "sha256": "c8253879df2ee0be3303e8457cf10e90f49fa282956eae38eaa9947f9a1a25b1" }, "downloads": -1, "filename": "flask-kafka-0.0.1.tar.gz", "has_sig": false, "md5_digest": "2aacdf3bdf42920a1931036ba2ebac71", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3236, "upload_time": "2019-09-11T14:38:16", "url": "https://files.pythonhosted.org/packages/a8/92/36a831bf076ccfeb5168d8eb8863795a5061141c2ccaec5a0c6fea326693/flask-kafka-0.0.1.tar.gz" } ], "0.0.2": [ { "comment_text": "", "digests": { "md5": "2626f30b681e1c21cfed877bbea308d0", "sha256": "1d3a90bb4940daa4b79418097bed1e2bf0577be4db14935ee778021777b45b93" }, "downloads": -1, "filename": "flask_kafka-0.0.2-py3-none-any.whl", "has_sig": false, "md5_digest": "2626f30b681e1c21cfed877bbea308d0", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 3801, "upload_time": "2019-09-11T14:38:14", "url": "https://files.pythonhosted.org/packages/60/53/a34c1fe91609326ec6b3b8042d1e8e557934c54c13ce83d8cf24cefeb7c0/flask_kafka-0.0.2-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "12178405cf7a343e6635d45938323afc", "sha256": "a58608321b76ba73f91b92996435056c07b525b885c047dbc0b80bc544afb666" }, "downloads": -1, "filename": "flask-kafka-0.0.2.tar.gz", "has_sig": false, "md5_digest": "12178405cf7a343e6635d45938323afc", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3629, "upload_time": "2019-09-11T14:38:18", "url": "https://files.pythonhosted.org/packages/a1/40/a4433156646bc8dd31c60670ff5ae98360cb43c98ebf2848e7171e7adf8f/flask-kafka-0.0.2.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "2626f30b681e1c21cfed877bbea308d0", "sha256": "1d3a90bb4940daa4b79418097bed1e2bf0577be4db14935ee778021777b45b93" }, "downloads": -1, "filename": "flask_kafka-0.0.2-py3-none-any.whl", "has_sig": false, "md5_digest": "2626f30b681e1c21cfed877bbea308d0", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 3801, "upload_time": "2019-09-11T14:38:14", "url": "https://files.pythonhosted.org/packages/60/53/a34c1fe91609326ec6b3b8042d1e8e557934c54c13ce83d8cf24cefeb7c0/flask_kafka-0.0.2-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "12178405cf7a343e6635d45938323afc", "sha256": "a58608321b76ba73f91b92996435056c07b525b885c047dbc0b80bc544afb666" }, "downloads": -1, "filename": "flask-kafka-0.0.2.tar.gz", "has_sig": false, "md5_digest": "12178405cf7a343e6635d45938323afc", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3629, "upload_time": "2019-09-11T14:38:18", "url": "https://files.pythonhosted.org/packages/a1/40/a4433156646bc8dd31c60670ff5ae98360cb43c98ebf2848e7171e7adf8f/flask-kafka-0.0.2.tar.gz" } ] }