Skip to content

Robust Listeners

Code Scratcher edited this page Oct 11, 2025 · 80 revisions

Use the new pg-listener to listen to notifications and for auto-handling connectivity issues.

It is much better than any options that used to be listed here. Therefore, they are all removed.


Testing Connectivity

In order to test your code properly, you need to manually disrupt DB communications.

Here are some ways of how this can be done while connected to your local database server:

  • To temporarily kill all connections to your test database, execute the following SQL:
SELECT pg_terminate_backend(pid) FROM pg_stat_activity WHERE datname='my-database-name';

You must provide the correct database name in the query, and make sure to execute it from a connection to a different database, or else you will be killing the current connection, which may crash your pgAdmin UI.

  • To permanently disconnect, locate your PostgreSQL Server in the list of services, and stop it.

  • There are many TCP utilities that can help you disrupt communications on TCP level for your database port.

Clone this wiki locally