nowfound

Life & fun · September 4, 2020

Pub/Sub with PostgreSQL under 40 lines of

How to use PostgreSQL's LISTEN/NOTIFY as a simple message queue with psycopg2 and asyncio - listen.py

Launched as “Pub/Sub with PostgreSQL under 40 lines of Python code”

Pub/Sub with PostgreSQL under 40 lines of launched on September 4, 2020 with 17 votes, #835 of 3,432 launches that month and more than 75% of that year's launches. The site was still online in September 2026, 6 years on.

Visit gist.github.com ↗Alternativestop 24% of September 2020

In plain words

This is a Python implementation that demonstrates how to build a publish-subscribe messaging system using PostgreSQL in under 40 lines of code. It is for developers who need a lightweight pub/sub solution without external dependencies. The implementation showcases how PostgreSQL's built-in features can handle message queuing and subscription patterns, making it useful for those wanting to understand pub/sub mechanics or integrate simple messaging into Python applications that already use PostgreSQL.

written by AI from its launch page and website · 9 September 2026

Originality

31/100

Crowded field. 69% of products launched in 2020 entered a less crowded field.

Similar products before it
4
in the archive on its launch day
See similar products ↓
Similar products since
9
launched after it
See similar products ↓

crowded fieldone of a kind

The score compares the words of this launch with every earlier launch in the archive: the fewer close matches on launch day, the higher the score. It says how new the idea was, not how good the product is. Similar products counted on November 30, 2026. See the similar products →This week’s most original launches →

Forecast

87%

chance that this product’s website is still online in November 2031. Typical launch of 2020 gets 81%.

1 year
98%
typical 97%
3 years
93%
typical 89%
5 years
87%
typical 81%
  • Pub/Sub with PostgreSQL under 40 lines of
  • Typical launch of 2020

Launch signals stronger than 91% of the archiveweakest → strongest

Made on November 29, 2026, when the site was online, from what was public on launch day. It is not revised, and it is graded when the site is checked again. How the forecast works and how often it is right →

From the sources

Anyone knows why conn.set_isolation_level(psycopg2.extensions.ISOLATION_LEVEL_AUTOCOMMIT) is important here? Not doubting that it is important. Because when I took the line out, the program didn't work. Just asking out of curiosity. psycopg2 is implemented according to PEP-249 (Python Database API Specification v2.0, "dbapi" for short), which states: Note that if the database supports an auto-commit feature, this must be initially off. So at every statement, a transaction is implicitly opened, but not committed, so whenever you want to finish the transaction, you have to explicitly COMMIT , unless you turn on "autocommit" mode ( Django does this by default , deviating from PEP 249 ), which…from gist.github.com
  • PgQueuer2024 · github.com · ▲376

    PgQueuer is a Python job queue that uses PostgreSQL for everything — queue storage, locking, notifications. No Redis, no RabbitMQ, no separate broker to operate. If your app already has Postgres, you already have the broker. After ~2 years and 26 minor releases, 1.0 ships today as the first stable release. Strict semver from here on. Thanks to everyone who contributed and left feedback!

  • HonkerApr 2026 · github.com · ▲327

    SQLite extension + bindings for Postgres NOTIFY/LISTEN semantics with durable queues, streams, pub/sub, and scheduler

  • PS
    Peerdb Streams2024 · ▲177

    PeerDB Streams enables change data capture from PostgreSQL databases using native logical decoding to replicate data changes to message queues including Kafka, Redpanda, and Google PubSub.

  • ElectricSQL, Postgres to SQLite active-active2023 · electric-sql.com · ▲617

    ElectricSQL is an open source sync layer that enables bidirectional data synchronization between Postgres databases and local SQLite instances, including in web browsers via WebAssembly.

  • An SQS Alternative on Postgres2024 · github.com · ▲241

    A lightweight message queue. Like AWS SQS and RSMQ but on Postgres.

  • Postgres.js2022 · github.com · ▲257

    Postgres.js - The Fastest full featured PostgreSQL client for Node.js, Deno, Bun and CloudFlare

More life & fun this month

the category →

Is Pub/Sub with PostgreSQL under 40 lines of yours? Feature it on the home page: $19, or free with the badge →

Source: Show HN post ↗

Launched alongside, September 2020

the whole month →