Skip to main content

RedQLite

A lightweight Messaging queue implementation using Redis for producer-worker-subscriber messaging.


Features

  • Redis-backed message queuing
  • Producer and worker interface
  • Producer and subscriber interface
  • Lightweight and fast alternative to Kafka/Celery
  • Works for long running tasks
  • Provides configurable heartbeats from inside worker callback functions
  • Redis server required
  • Minimal setup — no broker required

Installation

pip install redqlite

How It Works

This package simulates a basic messaging system using Redis lists. It includes:

A Producer that pushes messages to a Redis queue or broadcasts messages to all subscribers.

A Worker that consumes messages from the queue and processes them.

A Worker Pool to run concurrent workers.

A Subscriber that consumes messages from channel specific message queue.

Usage

Example: Producing a Message

# Import RQProducer class
from redqlite.producer import RQProducer

# Create a producer instance
rqproducer = RQProducer(host="localhost", port=6379)

# Send a message
rqproducer.send(topic="yourtopicname", message="hello world")

# Broadcast message on a channel
rqproducer.broadcast(channel="yourchannelname", message="hello world")

Example: Starting a Worker

# Import RQWorker class
from redqlite.worker import RQWorker

def callback_func(msg, **kwargs):
	print(msg)

# Create a worker instance
## Provide your redis connection details or Redis connection pool object
rqworker = RQWorker(host="localhost", port=6379, topic="yourtopicname", callback=callback_func)

# Start worker thread
rqworker.start()

Example: Starting a Worker Pool

# Import RQWorkerPool class
from redqlite.worker import RQWorkerPool

def callback_func(msg, **kwargs):
	print(msg)

# Create a worker pool
## Provide your redis connection details or Redis connection pool object
rqworker_pool = RQWorkerPool(host="localhost", port=6379, topic="yourtopicname", callback=callback_func, num_workers=2)

# Start worker pool
rqworker_pool.start()

Example: Starting a subscriber

# Import QSubscriber class
from redqlite.subscriber import RQSubscriber
from redis import Redis

def callback_func(msg, **kwargs):
	print(msg)

# Create a worker instance
rqsubscriber = RQSubscriber(redis_conn=Redis(), channel="yourchannelname", callback=callback_func)

# Start subscriber thread
rqsubscriber.start()

License

This project is licensed under the MIT License - see the LICENSE file for details.

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you’d like to change.

Contact

Feel free to reach out by opening an issue or by contacting the author.

Release files for redqlite 1.2.1

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

Source distribution (sdist)

Source distribution for redqlite 1.2.1
File Size Uploaded
redqlite-1.2.1.tar.gz 11.7 kB Details

Built distribution (wheel)

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

Total release size: 24.6 kB

Release files / redqlite-1.2.1.tar.gz

Download URL redqlite-1.2.1.tar.gz
Size 11.7 kB
Tags Source
SHA-256 checksum
How to use checksums
55c8597a96e9dc746d813e6a7ef13b330d2f00e855e2952864107e32ebd9afe6
BLAKE2b-256 checksum
How to use checksums
09a9102191c66de19f74dbd4a12196b06dbf796678af79597d6b72d220a691fb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.11

Release files / redqlite-1.2.1-py3-none-any.whl

Download URL redqlite-1.2.1-py3-none-any.whl
Size 13.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5ca5ea5d905c9eb44a05d02abd87deeacb47c2cb993f6386f0cb7440cb71ea6d
BLAKE2b-256 checksum
How to use checksums
896ea5199b79980b7ae6aca3e261c8f24cabd7b558bac5a57b9122073c2c2576
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.11

Release history Release notifications | RSS feed

This release

1.2.1 This release

2 release files

1.2.0

2 release files

1.1.0

2 release files

1.0.0

2 release files

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