Skip to main content
This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (pypi.python.org).
Help us improve Python packaging - Donate today!

Mixin for publishing events to RabbitMQ as avro datums

Project Description

AMQP Publishing Mixin for publishing a message as an Avro datum.

Installation

sprockets.mixins.avro-publisher is available on the Python Package Index and can be installed via pip or easy_install:

pip install sprockets.mixins.avro-publisher

Requirements

  • sprockets.mixins.amqp>=2.0.0
  • fastavro>=0.10.1,<1.0.0
  • tornado>=4.2.0,<5.0.0

Example

This examples demonstrates the most basic usage of 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):

    @gen.coroutine
    def get(self, *args, **kwargs):
        body = {'request': self.request.path, 'args': args, 'kwargs': kwargs}
        yield 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()

Source

sprockets.mixins.avro-publisher source is available on Github at https://github.com/sprockets/sprockets.mixins.avro-publisher

License

sprockets.mixins.avro-publisher is released under the 3-Clause BSD license.

Release History

Release History

This version
History Node

2.1.0

History Node

2.0.0

History Node

1.0.1

History Node

1.0.0

History Node

0.1.0

Download Files

Download Files

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

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
sprockets.mixins.avro-publisher-2.1.0.tar.gz (6.2 kB) Copy SHA256 Checksum SHA256 Source May 4, 2017

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting