Skip to main content

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):
    print(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.

id event state payload transaction_id created_at updated_at
7148 test 0 {"i": 58} 2024-07-26 17:20:51.34825 2024-07-26 17:20:51.34825
2 test 1 {"i": 1} 8000142a-42b9-4656-8518-81e3ee6bd20b 2024-07-26 14:06:22.596648 2024-07-26 16:15:56.322857
3 test 1 {"i": 2} a6e8b353-c53d-48fb-b8b0-5a972648b384 2024-07-26 14:06:22.598692 2024-07-26 16:15:57.381679

Not consumed events have a state of 0, while consumed events have a state of 1. The transaction_id is used to ensure that events are consumed only once.

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!

Metadata

Release files for queupy 0.2.5

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

Source distribution (sdist)

Source distribution for queupy 0.2.5
File Size Uploaded
queupy-0.2.5.tar.gz 7.7 kB Details

Built distribution (wheel)

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

Total release size: 17.2 kB

Release files / queupy-0.2.5.tar.gz

Download URL queupy-0.2.5.tar.gz
Size 7.7 kB
Tags Source
SHA-256 checksum
How to use checksums
59754c531662e7bb3a23ac5cfeea063765f2ad4461a36ad5b045f2de6d6df781
BLAKE2b-256 checksum
How to use checksums
26f28e3440d24e38f647935294411e7175d8df5a6dae64c014eb9d28dfae3a19
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.12.4

Release files / queupy-0.2.5-py3-none-any.whl

Download URL queupy-0.2.5-py3-none-any.whl
Size 9.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
da4d7dcef57f08d991a2761db1bdd57eabeaac557adbe88328b070dbdcb9fec9
BLAKE2b-256 checksum
How to use checksums
ca57a94d077d3f289a7664316d428cdf07830c1465fab483932917597f319a82
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.12.4

Release history Release notifications | RSS feed

This release

0.2.5 This release

2 release files

0.2.4

2 release files

0.1.3

2 release files

0.1.2

1 release file

0.1.1

2 release files

0.1

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