Python service that publishes Postgres LISTEN/NOTIFY events to Pulsar.
See:
- Python 3.10+
- Access to the meemoo PyPI (VPN required)
- Clone this repository and change into the new dir:
git clone git@github.com:viaacode/pg-listener-py.git
cd pg-listener-py- Init and activate a virtual env:
python3 -m venv .venv
source .venv/bin/activate- Install the library and the dev/test dependencies:
(.venv) python -m pip install . \
--extra-index-url http://do-prd-mvn-01.do.viaa.be:8081/repository/pypi-all/simple \
--trusted-host do-prd-mvn-01.do.viaa.be- Fill in and export the environment variables in
.env:
(.venv) export $(grep -v '^#' .env | xargs)Check usage:
(.venv) python main.py -h
usage: main.py [-h] [-c [CHANNEL_NAME]]
Python service that publishes Postgres LISTEN/NOTIFY events to Pulsar.
options:
-h, --help show this help message and exit
-c [CHANNEL_NAME], --channel-name [CHANNEL_NAME]
Name of the channel to listen to. If provided, overrides the configuration value.- Run with:
(.venv) python main.py- Login to the configured database and test with, for example:
db_name=> NOTIFY a_channel_name, '{"essence_name": "a value"}';