Skip to main content

RabbitMQ extension for yhttp.

Project description

yhttp-rabbitmq

PyPI Build Coverage Status

RabbitMQ extension for yhttp.

Install

pip install yhttp-pony

Usage

from yhttp import Application
from yhttp.ext.rabbitmq import install as rabbitmq_install


app = Application()
rabbitmq_install(app)
app.settings.merge('''
rabbitmq:
  host: localhost
  port: 5672
  virtualhost: /
  user: guest
  password: guest
  channel_max: 10
  connection_attempts: 3
  
  ssl:
    ca_certfile:  <ca_cert>
    certfile: <client_cert>
    keyfile: <client_key>
    commonname: <CN>
 
  pool:
    maxsize: 10
    maxoverflow: 10
    timeout: 10
    recycle: 3600
    stale: 45
''')
app.ready()


@app.route()
def get(req):
    with app.rabbitmq.acquire() as cxn:
        cxn.channel.basic_publish(
            body='banana',
            exchange='',
            routing_key='fruits',
            properties=pika.BasicProperties(
                content_type='text/plain',
                content_encoding='utf-8',
                delivery_mode=2,
            )
        )

app.ready()

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

yhttp-rabbitmq-1.0.0.tar.gz (6.1 kB view hashes)

Uploaded Source

Built Distribution

yhttp_rabbitmq-1.0.0-py3.8.egg (11.3 kB view hashes)

Uploaded Source

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