# 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

Page: https://nowfound.app/launch/pub-sub-with-postgresql-under-40-lines-of-python-code

- Launched: 2020-09-04
- Launch-day votes: 17, 5 comments; #835 of 3,432 launches that month (top 24%)
- Website: [gist.github.com](https://gist.github.com/kissgyorgy/beccba1291de962702ea9c237a900c79), online when checked 2026-09-18
- Category: [Life & fun](https://nowfound.app/c/life-and-consumer.md)
- Forecast: 87% chance its website is still online in November 2031 (98% in November 2027, 93% in November 2029). Made 2026-11-29 and not revised. Typical launch of 2020: 81%. [Method](https://nowfound.app/forecast.md)
- Originality: 31/100 (crowded field). More original than 31% of products launched in 2020. On its launch day the archive already held 4 similar products; 9 products like it have launched since.

## 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, 2026-09-09._

## Does a similar job

- [PgQueuer](https://nowfound.app/launch/pgqueuer-transform-postgresql-into-a-job-queue): 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… (2024-08-18, 376 votes, free, forecast: 95% online in 2031, github.com)
- [Honker](https://nowfound.app/launch/honker-postgres-notify-listen-semantics-for-sqlite): SQLite extension + bindings for Postgres NOTIFY/LISTEN semantics with durable queues, streams, pub/sub, and scheduler (2026-04-23, 327 votes, free, forecast: 90% online in 2031, github.com)
- [Peerdb Streams](https://nowfound.app/launch/peerdb-streams-simple-native-postgres-change-data-capture): 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. (2024-05-06, 177 votes, forecast: 88% online in 2031)
- [ElectricSQL, Postgres to SQLite active-active](https://nowfound.app/launch/electricsql-postgres-to-sqlite-active-active-sync-for-local): 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. (2023-09-20, 617 votes, free tier, from $5/mo, forecast: 96% online in 2031, electric-sql.com)
- [An SQS Alternative on Postgres](https://nowfound.app/launch/an-sqs-alternative-on-postgres): A lightweight message queue. Like AWS SQS and RSMQ but on Postgres. (2024-05-09, 241 votes, free, forecast: 96% online in 2031, github.com)
- [Postgres.js](https://nowfound.app/launch/postgres-js-fastest-full-featured-postgresql-client-for-node): Postgres.js - The Fastest full featured PostgreSQL client for Node.js, Deno, Bun and CloudFlare (2022-03-24, 257 votes, free, forecast: 94% online in 2031, github.com)

All alternatives: https://nowfound.app/alternatives/pub-sub-with-postgresql-under-40-lines-of-python-code.md

## For the maker of Pub/Sub with PostgreSQL under 40 lines of

- Feature it at the top of the NowFound home page for $19 for 30 days, marked sponsored: https://nowfound.app/feature/pub-sub-with-postgresql-under-40-lines-of-python-code
- Free: put the badge on the product's own site and it joins Featured products after the paid spots, and this page links to the site with a normal link search engines follow. HTML for the footer: `<a href="https://nowfound.app/launch/pub-sub-with-postgresql-under-40-lines-of-python-code"><img src="https://nowfound.app/badge/pub-sub-with-postgresql-under-40-lines-of-python-code.svg" alt="Pub/Sub with PostgreSQL under 40 lines of on NowFound" height="32"></a>`

Source: [Show HN post](https://news.ycombinator.com/item?id=24376541)
