将事件发布到RabbitMQ作为avro数据集的混合件
项目描述
作为Avro数据集发布消息的AMQP发布混合件。
安装
sprockets.mixins.avro-publisher 可在 Python包索引 中找到,可以通过 pip 或 easy_install 进行安装。
pip install sprockets.mixins.avro-publisher
要求
sprockets.mixins.amqp>=3.0.0
fastavro>=0.10.1,<2.0.0
tornado>=6,<7
示例
此示例演示了 sprockets.mixins.avro-publisher 最基本的用法。
export AMQP_URL="amqp://user:password@rabbitmq_host:5672/%2f"
python my-example-app.py
from tornado import gen
from tornado import web
from sprockets.mixins import avro_publisher
def make_app(**settings):
settings = {'avro_schema_uri_format': 'http://my-schema-repository/%(name)s.avsc'}
application = web.Application(
[
web.url(r'/', RequestHandler),
], **settings)
avro_publisher.install(application)
return application
class RequestHandler(avro_publisher.PublishingMixin, web.RequestHandler):
async def get(self, *args, **kwargs):
body = {'request': self.request.path, 'args': args, 'kwargs': kwargs}
await self.avro_amqp_publish(
'exchange',
'routing.key',
'avro-schema-name'
body)
if __name__ == "__main__":
application = make_app()
application.listen(8888)
logging.basicConfig(level=logging.INFO)
ioloop.IOLoop.current().start()
源代码
sprockets.mixins.avro-publisher 源代码可在 Github 上找到,网址为 https://github.com/sprockets/sprockets.mixins.avro-publisher
许可证
sprockets.mixins.avro-publisher 在 3-Clause BSD许可证 下发布。
项目详情
关闭
sprockets.mixins.avro-publisher-3.0.1.tar.gz的哈希值
算法 | 哈希摘要 | |
---|---|---|
SHA256 | 3e8c859932ea460ae982a1259ba8c9eb5bb3707df865f51375914d15c2d553a2 |
|
MD5 | 535396daa268a777a17be3349d195605 |
|
BLAKE2b-256 | e8429399b9e97e44bad3845bbf6df8d3b1de14b4c465b0a605aa5f5cdd25a3bb |