Mixin for publishing events to RabbitMQ
Project description
AMQP Publishing Mixin for Tornado RequestHandlers.
Installation
sprockets.mixins.amqp is available on the Python Package Index and can be installed via pip or easy_install:
pip install sprockets.mixins.amqp
Documentation
Requirements
pika>=0.10.0
tornado>=4.2.0
Example
This examples demonstrates the most basic usage of sprockets.mixins.amqp
export AMQP_URL="amqp://user:password@rabbitmq_host:5672/%2f"
python my-example-app.py
import json
from tornado import gen
from tornado import web
from sprockets.mixins import amqp
class RequestHandler(amqp.PublishingMixin, web.RequestHandler):
@gen.coroutine
def get(self, *args, **kwargs):
body = {'request': self.request.path, 'args': args, 'kwargs': kwargs}
yield self.amqp_publish('exchange', 'routing.key', json.dumps(body),
{'content_type': 'application/json'})
Source
sprockets.mixins.amqp source is available on Github at https://github.com/sprockets/sprockets.mixins.amqp
License
sprockets.mixins.amqp is released under the 3-Clause BSD 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
Close
Hashes for sprockets.mixins.amqp-0.1.4.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | f07bda18670b2f381ddafbe8a9f0d373f0b74b7b642a4f27e9dbc80642b06878 |
|
MD5 | a644776270554ae2483e0a014d8e0cde |
|
BLAKE2b-256 | 3a8fa5108a264bbea8e8dfe9f00511abbd0a75ed7b9134ecfaaea6c6fc897593 |