Skip to main content

RedisMQ

PyPI version Build Status codecov Documentation Status

Description

RedisMQ uses the redis stream data structure to effect a message queue. The stream key name is the id of the message queue.

It provides support for confirmed and unconfirmed guaranteed message queuing. Guaranteed messages will remain in the queue (as unread or pending messages in the redis stream) until they are read and acknowledged by exactly one consumer. Confirmed producers will get a response only when the message is received and processed by a consumer. Unconfirmed (but guaranteed) still means only a single consumer will process the message, but no response is sent.

RedisMQ also provides support for fan-out (pub/sub) messaging when zero or more subscribers should receive the message.

RedisMQ libraries for Python and Javascript are available.

Requirements

The RedisMQ module requires Python 3.8 or higher.

Prerequisites

Install Python development headers

On Ubuntu/Debian systems or Microsoft Windows:

apt-get install python-dev

On Redhat/Fedora systems, install them with:

yum install python-devel

On Mac OSX:

xcode-select --install

Installation

To install RedisMQ:

$ pip install redismq

or from source:

$ python setup.py install

testing:

pipenv install --dev
pipenv run pytest

debugging:

export REDISMQ=DEBUG
...

Getting Started

RedisMQ needs to connect to an existing redis server, so you will need the address and port of the server you want to use. RedisMQ also stores global state in the redis server. By default the namespace used for global keys is rmq:*. If you need to change this so it does not conflict with other data stored in redis, the configuration parameter redismq_namespace should be set to something different.

Examples

Here are some examples of using the pyredismq module. See more examples here.

Sending an unconfirmed message

From a Python shell we send an unconfirmed message:

>>> import asyncio
>>> from redismq import Client
>>> async def sendAMessage():
...     mq_connection = await Client.connect('redis://127.0.0.1')
...     my_producer = await mq_connection.producer('mystream')
...     print( await my_producer.addUnconfirmedMessage('Hello there!'))
...
>>> asyncio.run(sendAMessage())
"1601460642682-0"

Sending a confirmed message

From a Python shell we send a confirmed message:

>>> import asyncio
>>> from redismq import Client
>>> async def sendAConfirmedMessage():
...     mq_connection = await Client.connect('redis://127.0.0.1')
...     my_producer = await mq_connection.producer('mystream')
...     response = await my_producer.addConfirmedMessage('Hello there! Let me know when you get this.')
...     print('Got confirmation', response)
...
>>> asyncio.run(sendAConfirmedMessage())

Consuming a message

From a Python shell we consume a message:

>>> from redismq import Client
>>> async def readAndConfirmMessage():
>>>     mq_connection = await Client.connect('redis://127.0.0.1')
>>>     my_consumer = await mq_connection.consumer('mystream', 'mygroup', 'consumer1')
>>>     payload = await my_consumer.read()
>>>     print('Got message', payload.message)
>>>     # here you can do something with the message
>>>     # the response passed to ack() is optional, 
>>>     # and ignored if the original message was unconfirmed:
>>>     resp = 'I got your message' if payload.responseChannel else ''
>>>     await payload.ack(resp)

More Information

RedisMQ is free software under the New BSD license, see LICENSE.txt for details.

Metadata

Release files for redismq 1.1.8

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for redismq 1.1.8
File Size Uploaded Provenance
redismq-1.1.8.tar.gz 13.7 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for redismq 1.1.8
File Interpreter ABI Platform
redismq-1.1.8-py3-none-any.whl Python 3 none any Details

Total release size: 24.8 kB

Release files / redismq-1.1.8.tar.gz

Download URL redismq-1.1.8.tar.gz
Size 13.7 kB
Tags Source
SHA-256 checksum
How to use checksums
2512648d7c3c0b5a8c4ae468f14fd0108bf407bb8b2bd13a170e079db766f6a2
BLAKE2b-256 checksum
How to use checksums
9f6553f64f543a1fbcd32c2752d599c51531a71db04d75227e57bb76189c294f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.0.1 CPython/3.12.8

Release files / redismq-1.1.8-py3-none-any.whl

Download URL redismq-1.1.8-py3-none-any.whl
Size 11.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9bcd50a35da183e22cbf723a9df4fc2def228c208fa6c2c2fac9a705550978de
BLAKE2b-256 checksum
How to use checksums
25267a1543847485ac2d2380b92538312e6921fb3cad6d14212e8911034607bc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.0.1 CPython/3.12.8

Security for redismq 1.1.8

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page