sqlx/examples/listen-postgres
2020-03-16 18:35:37 -07:00
..
src listen: merge PgListener and PgPoolListener; allow PgListener to be used as an Executor; allow channels to be adjusted at run-time 2020-03-16 18:35:37 -07:00
Cargo.toml listen: prefix example with sqlx-example- 2020-03-16 18:27:04 -07:00
README.md Rename new example to match current nomenclature. 2020-03-15 02:17:14 -07:00

Postgres LISTEN/NOTIFY

Usage

Declare the database URL. This example does not include any reading or writing of data.

export DATABASE_URL="postgres://postgres@localhost/postgres"

Run.

cargo run

The example program should connect to the database, and create a LISTEN loop on a predefined set of channels. A NOTIFY task will be spawned which will connect to the same database and will emit notifications on a 5 second interval.