Skip to main content

pgqmini is a lightweight, easy-to-use Python library for managing PostgreSQL message queues.

Project description

pgqmini

version license

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

  1. Installation
  2. Usage
  3. Contributing
  4. License
  5. Contact

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

pgqmini-0.0.4.tar.gz (5.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pgqmini-0.0.4-py3-none-any.whl (6.1 kB view details)

Uploaded Python 3

File details

Details for the file pgqmini-0.0.4.tar.gz.

File metadata

  • Download URL: pgqmini-0.0.4.tar.gz
  • Upload date:
  • Size: 5.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.1

File hashes

Hashes for pgqmini-0.0.4.tar.gz
Algorithm Hash digest
SHA256 d8a2b522ae91977f8c430ed2da883953533a5ccbd6a908ad75bfc7810ec945ef
MD5 708e1329bd23aefaa89d46113ec9f73b
BLAKE2b-256 bab2d1ccc919741f32ef2a97423ee9b02391a82a0a406bb86b925d6fe082a4c6

See more details on using hashes here.

File details

Details for the file pgqmini-0.0.4-py3-none-any.whl.

File metadata

  • Download URL: pgqmini-0.0.4-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

Hashes for pgqmini-0.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 b550abdcccf69b43090f6dacc7b18cc76255e2758f8dd85eaf3ca80777866de2
MD5 3d890e91e6cfaa9d7d025be4222f2629
BLAKE2b-256 5ebc6ad69faae1449da1e1d3b12ad4dfbc08e1f4dd9518ba57907ecb8738046a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page