A queuing library based on Peewee
Project description
Queupy
Queupy is a Python library designed to provide a fast and safe message queuing system using PostgreSQL. It creates a dedicated table _queupy_event to handle event messages efficiently with both producer and consumer functionalities.
Features
- Simple initialization and setup (no need for additional services)
- Efficient event queuing using PostgreSQL
- Easy-to-use producer and consumer interfaces for event handling
Installation
To install Queupy, use pip:
pip install queupy
Usage
Consumer Example
Below is an example of how to use Queupy to consume events from the queue.
from queupy import init_queue
event_queue = init_queue(
database_name='queupy',
host='localhost',
user='queupy',
password='queupy',
)
for event in event_queue.consume('test', frequency=0.01):
logger.info(f"Consuming event {event}")
Producer Example
Here is an example of how to use Queupy to push events to the queue.
from queupy import init_queue
event_queue = init_queue(
database_name='queupy',
host='localhost',
user='queupy',
password='queupy',
)
for i in range(1000):
event_queue.push('test', {'i': i})
Configuration
Database Configuration
Ensure that your PostgreSQL database is properly configured and accessible. Queupy requires the following parameters for initialization:
database_name: The name of your PostgreSQL database.host: The host address of your PostgreSQL server.user: The username to access your PostgreSQL database.password: The password for the PostgreSQL user.
Table Schema
Queupy will automatically create the _queupy_event table in your specified database. Ensure your database user has the necessary permissions to create and modify tables.
Contributing
Contributions are welcome! Please fork the repository and submit a pull request with your improvements.
License
This project is licensed under the MIT License. See the LICENSE file for details.
Contact
For any questions or issues, please open an issue on the GitHub repository or contact the author at [enzo.the@gmail.com]
Happy queuing with Queupy!
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file queupy-0.1.tar.gz.
File metadata
- Download URL: queupy-0.1.tar.gz
- Upload date:
- Size: 4.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
43f351b03df8e96cc48eabd519ecb60385faab5b270759ceaae897a1b92769bd
|
|
| MD5 |
03f642d668d5b7147be5a7bd929eb8e1
|
|
| BLAKE2b-256 |
b3eb653cb28f3170e52b170c436f65e09eb3ca9a6f102c7ad943e27b198cad77
|
File details
Details for the file queupy-0.1-py3-none-any.whl.
File metadata
- Download URL: queupy-0.1-py3-none-any.whl
- Upload date:
- Size: 5.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3a77bbb287f751641350ede59b67ff3e013938bb08749afbb2580d47bb2fb19d
|
|
| MD5 |
90afd8c677611931c56aa8417e054b2b
|
|
| BLAKE2b-256 |
0fd513f5bdf8da1428bdf23cead3d29ddfc7ca4df0004cfa7d1ac5b409afa52a
|