pgqmini is a lightweight, easy-to-use Python library for managing PostgreSQL message queues.
Project description
pgqmini
pgqmini is a lightweight, easy-to-use Python library for managing PostgreSQL message queues. It provides a simple interface for adding and retrieving messages from a PostgreSQL-based queue, as well as handling timeouts and managing message processing.
Table of Contents
Installation
To install pgqmini, you can use pip:
pip install pgqmini
You also need to have a PostgreSQL server up and running. The library uses the psycopg2 package to connect to the PostgreSQL server.
Usage
Here is a basic example of how to use pgqmini:
Publisher
from pgqmini import PGQ
pgq = PGQ(
qname="message_queue",
dbname="pgq",
host="127.0.0.1",
user="username",
password="password",
port=5432,
)
pgq.connect()
pgq.pub('{"key1": "value1", "key2": "value2"}')
pgq.disconnect()
Subscriber
from pgqmini import PGQ
pgq = PGQ(
qname="message_queue",
dbname="pgq",
host="127.0.0.1",
user="username",
password="password",
port=5432,
)
pgq.connect()
def process_message(payload: str):
print(payload)
while True:
pgq.sub(process_message)
In this code, we first create a PGQ object with the necessary database connection parameters. We then connect to the database and enter a loop where we process messages from the queue.
For a more detailed usage guide, please check out the Usage Guide in our wiki.
License
pgqmini is released under the MIT License. See the LICENSE file for more details.
Contact
If you have any questions, issues, or suggestions, please open an issue in this repository, or contact the maintainer at jangsc0000@gmail.com.
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 pgqmini-0.0.6.tar.gz.
File metadata
- Download URL: pgqmini-0.0.6.tar.gz
- Upload date:
- Size: 5.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
34c055b2ea47d3a4d42329365363c696874d946d7ffcfb67c64213d4519638e0
|
|
| MD5 |
d61c5b73f0906837d0a41095a7cd33bc
|
|
| BLAKE2b-256 |
814f60d4af90f8e29a1fc674fcd83c2faa20255868773bed09c4518a4e3d782a
|
File details
Details for the file pgqmini-0.0.6-py3-none-any.whl.
File metadata
- Download URL: pgqmini-0.0.6-py3-none-any.whl
- Upload date:
- Size: 6.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
516007a1e043c8e1cd5806884e6e5238668930c2a536056a44c1729ab7ea6d86
|
|
| MD5 |
e4e530abe3ffffe72e537dd5b7809578
|
|
| BLAKE2b-256 |
b1f074fcd4e45b6ab193a36aa6f75aa3a806b61d972bb95f770e389441576932
|