{"id":17962679,"url":"https://github.com/fgribreau/postgresql-to-amqp","last_synced_at":"2025-03-25T04:32:12.937Z","repository":{"id":62442825,"uuid":"87241096","full_name":"FGRibreau/postgresql-to-amqp","owner":"FGRibreau","description":"PostgreSQL to AMQP, forward PostgreSQL notifications to an AMQP queue.","archived":false,"fork":false,"pushed_at":"2020-07-09T09:58:43.000Z","size":25,"stargazers_count":30,"open_issues_count":8,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-19T08:55:19.207Z","etag":null,"topics":["amqp","amqp-queue","crates","events","notifications","pgnotify","postgresql","rabbitmq"],"latest_commit_sha":null,"homepage":"https://twitter.com/FGRibreau","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/FGRibreau.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-04-04T22:28:24.000Z","updated_at":"2022-08-19T16:42:21.000Z","dependencies_parsed_at":"2022-11-01T22:15:41.971Z","dependency_job_id":null,"html_url":"https://github.com/FGRibreau/postgresql-to-amqp","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FGRibreau%2Fpostgresql-to-amqp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FGRibreau%2Fpostgresql-to-amqp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FGRibreau%2Fpostgresql-to-amqp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FGRibreau%2Fpostgresql-to-amqp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/FGRibreau","download_url":"https://codeload.github.com/FGRibreau/postgresql-to-amqp/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245401360,"owners_count":20609161,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["amqp","amqp-queue","crates","events","notifications","pgnotify","postgresql","rabbitmq"],"created_at":"2024-10-29T11:20:09.842Z","updated_at":"2025-03-25T04:32:12.661Z","avatar_url":"https://github.com/FGRibreau.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# :warning: Discontinued\n\n### @subzerocloud took inspiration from this project and built [pg-amqp-bridge](https://github.com/subzerocloud/pg-amqp-bridge) which now has more options, use it instead :+1:\n\n---------------------------------------------------------\n\n\n# 🚇 PostgreSQL to AMQP gateway \n#### Forward PostgreSQL `pg_notify` notifications to an AMQP queue.\n\n[![Cargo version](https://img.shields.io/crates/v/postgresql-to-amqp.svg)](https://crates.io/crates/postgresql-to-amqp) [![Crates.io](https://img.shields.io/crates/l/postgresql-to-amqp.svg)](https://crates.io/crates/postgresql-to-amqp) [![Crates.io](https://img.shields.io/crates/d/postgresql-to-amqp.svg)](https://crates.io/crates/postgresql-to-amqp) [![Docker Automated build](https://img.shields.io/docker/automated/fgribreau/postgresql-to-amqp.svg)](https://hub.docker.com/r/fgribreau/postgresql-to-amqp) [![Docker Pulls](https://img.shields.io/docker/pulls/fgribreau/postgresql-to-amqp.svg)](https://hub.docker.com/r/fgribreau/postgresql-to-amqp) [![Docker Stars](https://img.shields.io/docker/stars/fgribreau/postgresql-to-amqp.svg)](https://hub.docker.com/r/fgribreau/postgresql-to-amqp) [![Slack](https://img.shields.io/badge/Slack-Join%20our%20tech%20community-17202A?logo=slack)](https://join.slack.com/t/fgribreau/shared_invite/zt-edpjwt2t-Zh39mDUMNQ0QOr9qOj~jrg)\n==================\n\n\u003cp align=\"center\"\u003e\u003cimg src=\"https://cloud.githubusercontent.com/assets/138050/24724213/9c512220-1a4a-11e7-8a3e-9b8ad0945f51.gif\"/\u003e\u003c/p\u003e\n\n\n\n## ⛴ Cargo\n\n```shell\ncargo install postgresql-to-amqp\n```\n\n## 🐳 Docker \n```shell\ndocker run --rm -it \\\n-e POSTGRESQL_URI=postgresql://username:password@domain.tld:port/database \\\n-e POSTGRESQL_CHANNEL=foo \\\n-e AMQP_URI=amqp://127.0.0.1:5672/ \\\n-e AMQP_QUEUE_NAME=queueName fgribreau/postgresql-to-amqp\n```\n\n## ⚙ Configuration\n\nConfiguration is done through environment variables:\n\n- **POSTGRESQL_URI**: e.g. `postgresql://username:password@domain.tld:port/database`\n- **POSTGRESQL_CHANNEL**: e.g. `foo`\n- **AMQP_URI**: e.g. `amqp://127.0.0.1:5672/`\n- **AMQP_QUEUE_NAME**: e.g. `queueName`\n\n## 🎩 Usage\n\nStart the forwarder:\n\n```bash\nPOSTGRESQL_URI=\"postgresql://username:password@domain.tld:port/database\" POSTGRESQL_CHANNEL=\"foo\" AMQP_URI=\"amqp://127.0.0.1:5672/\" AMQP_QUEUE_NAME=\"queueName\" postgresql-to-amqp\n```\n\n\nExecute in psql:\n\n```sql\nSELECT pg_notify('foo', 'payload');\n```\n\nThe forwarder will log and forward the notification to the amqp queue:\n\n```\nForwarding Notification { process_id: 31694, channel: \"foo\", payload: \"payload\" } to queue \"queueName\"\n```\n\n## 👁 Philosophy\n\n- Low memory consumption (1,9Mo)\n- Single binary\n- No dependency\n- Predictable performance\n\n\n## 🔫 Todo\n\nI will happily accept PRs for this:\n\n- [ ] AMQP connection string (AMQP authentication support) 👻\n- [ ] Support JSON message\n- [ ] Publish to exchange\n- [ ] Add original channel as message property\n- [ ] Add postgresql-to-amqp `version` as message property\n- [ ] Let environment variables specify additional message properties\n- [ ] Handle AMQP disconnection/reconnection\n- [ ] Handle PostgreSQL disconnection/reconnection\n- [ ] Health check route\n- [ ] Metric route\n- [x] Docker support\n- [ ] Kubernetes support 😍\n- [ ] Make a first major release with tests ☝️\n\n## Related work\n\n- [pgsql-listen-exchange](https://github.com/gmr/pgsql-listen-exchange) - RabbitMQ Exchange that publishes messages received from PostgreSQL Notifications\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffgribreau%2Fpostgresql-to-amqp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffgribreau%2Fpostgresql-to-amqp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffgribreau%2Fpostgresql-to-amqp/lists"}