Skip to main content

A RabbitMQ client for the SSEC.

Project description

QuickMQ

pipeline status coverage report PyPI version shields.io
PyPI pyversions

An easy-to-use RabbitMQ client created for use at the SSEC.

Table of Contents

Description

QuickMQ is a high level RabbitMQ publisher made for the SSEC.

Current features:

  • Multi-server publishing
  • Publisher confirms
  • Automatic reconnection
  • Publishing message status

To see the requirements of this project check out the reqs and specs doc.

Installation

Installation Requirements

Python >= 3.6

The latest release of quickmq can be installed from PyPi using pip:

pip install --upgrade quickmq

To install the most recent version from GitLab.

pip install git+https://gitlab.ssec.wisc.edu/mdrexler/ssec_amqp.git

Usage

QuickMQ comes with an easy-to-use API.

Connect to servers:

import ssec_amqp.api as mq

mq.connect('server1', 'server2', user='username', password='password', exchange='satellite')
# Connects to the 'satellite' exchange on server1 and server2

Publish messages:

# continued from code block above

status = mq.publish({'payload': 'test'}, route_key='this.that')
# publish a message to all connected servers using a route key of 'this.that'

status # the status is returned as a dictionary
{'amqp://username@server1:5672//satellite': <DeliveryStatus.DELIVERED: "DELIVERED">, 'amqp://username@server2:5672//satellite': <DeliveryStatus.DROPPED: "DROPPED">}

A DROPPED status means that the connection to the AMQP server is currently reconnecting.
A REJECTED status means that the message was refused by the AMQP server.

Get status of current connections:

# continued from code block above

print(mq.status())
{'amqp://username@server1:5672//satellite': <ConnectionStatus.CONNECTED: "CONNECTED">, 'amqp://username@server2:5672//satellite': <ConnectionStatus.RECONNECTING: "RECONNECTING">}

You can also use the classes that drive the api directly.

from ssec_amqp import AmqpClient, AmqpExchange, DeliveryStatus

client = AmqpClient()

client.connect(AmqpExchange('server1', user='username', password='password'))

client.publish({'payload': 'test'})

client.disconnect()

Author

Created/Maintained by Max Drexler.

License

MIT License. See LICENSE for more information.

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

quickmq-1.0.3.tar.gz (14.7 kB view hashes)

Uploaded Source

Built Distribution

quickmq-1.0.3-py3-none-any.whl (9.2 kB view hashes)

Uploaded Python 3

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