PGMQ (PostgreSQL Message Queue)#
https://github.com/pgmq/pgmq
PGMQ is a lightweight message queue based on PostgreSQL.
It is implemented using a PostgreSQL Extension.
Since it relies solely on PostgreSQL, it is highly suitable for lightweight business requirements that need a message queue.
Currently, we use it in a scenario with an existing API Server + PGMQ + consumer
to handle asynchronous tasks and retry mechanisms for third-party services.
More broadly,
especially in scenarios where your infrastructure currently only includes PostgreSQL and you wish to avoid introducing RabbitMQ or major cloud messaging solutions, yet still require Pub/Sub or SQS-like functionality,
PGMQ is a compelling choice.
For more detailed comparisons with other message queues and usage examples, please refer to the following article:
Why Choose PGMQ? Implementing ACID Transactional Message Queues in PostgreSQL
PGMQ-SQLAlchemy 0.2.0 New Features#
- Added
op(PGMQOperation) module: Officially supports handling business logic and message queue operations within the same Transaction, ensuring ACID compliance for both messages and business data. - Added FastAPI,
asyncioConsumer Pub/Sub Example: Demonstrates how to integrate PGMQ-SQLAlchemy with FastAPI and implement asynchronous message consumers. This example is also included in System Tests to ensure functional correctness. - Improved Unit (Integration) Test Coverage: Test coverage has reached
98.72%. Why refer to it as “unit (integration)” testing? Because the CI pipeline runs tests against a real Postgres DB, making them effectively integration tests. - Official Documentation Supports Dark Mode: Switched from sphinx_rtd_theme to furo to officially support Dark Mode.
GitHub Coding Agent#
A primary motivation for maintaining this package is to evaluate the effectiveness of GitHub Coding Agent. Here are some PRs demonstrating impressive results:






