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_message('{"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()

while True:
    try:
        msg = pgq.sub_message()
        process_message(msg)
        pgq.complete_message(msg)
    except Exception as e:
        pgq.rollback_message(msg)

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.3.tar.gz (4.9 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.3-py3-none-any.whl (5.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pgqmini-0.0.3.tar.gz
  • Upload date:
  • Size: 4.9 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.3.tar.gz
Algorithm Hash digest
SHA256 f9bd244d56e032e0871226b1caeb77806cf2fe9e923ad392abf2a865d9621cdf
MD5 dd51a6a191b19606e170548eeb4fedff
BLAKE2b-256 bd60b89decb4fd855e158fbaabffd3a5738e926105ebb3c88df523a2102297a5

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pgqmini-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 5.3 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.3-py3-none-any.whl
Algorithm Hash digest
SHA256 8f1cf2b6e77fbe5536dae435b9583e1b63eb0a9f3fdd07f256f90f4ac1e6eed2
MD5 9aa4d4a217ac88649f07c0d5689cf983
BLAKE2b-256 5d75bae1083ff442c58d6b0a3e07f1314ef2b94651ab5a96dc2d85306d8b1e10

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