Skip to content

Python service that publishes Postgres LISTEN/NOTIFY events to Pulsar

Notifications You must be signed in to change notification settings

viaacode/pg-listener-py

Repository files navigation

pg-listener-py

Python service that publishes Postgres LISTEN/NOTIFY events to Pulsar.

See:

Prerequisites

  • Python 3.10+
  • Access to the meemoo PyPI (VPN required)

Development and testing

  1. Clone this repository and change into the new dir:
git clone git@github.com:viaacode/pg-listener-py.git
cd pg-listener-py
  1. Init and activate a virtual env:
python3 -m venv .venv
source .venv/bin/activate
  1. 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

Usage

  1. 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.
  1. Run with:
(.venv) python main.py
  1. Login to the configured database and test with, for example:
db_name=> NOTIFY a_channel_name, '{"essence_name": "a value"}';

About

Python service that publishes Postgres LISTEN/NOTIFY events to Pulsar

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •