{"id":48703660,"url":"https://github.com/brianpursley/pgmq-cli","last_synced_at":"2026-04-11T10:38:07.838Z","repository":{"id":350010371,"uuid":"1155906305","full_name":"brianpursley/pgmq-cli","owner":"brianpursley","description":"A CLI for PGMQ","archived":false,"fork":false,"pushed_at":"2026-04-08T20:03:23.000Z","size":73,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-04-11T10:37:55.637Z","etag":null,"topics":["cli","golang","pgmq","postgres","postgresql","queues"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/brianpursley.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":"AGENTS.md","dco":null,"cla":null}},"created_at":"2026-02-12T03:18:24.000Z","updated_at":"2026-04-08T19:59:45.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/brianpursley/pgmq-cli","commit_stats":null,"previous_names":["brianpursley/pgmq-cli"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/brianpursley/pgmq-cli","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brianpursley%2Fpgmq-cli","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brianpursley%2Fpgmq-cli/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brianpursley%2Fpgmq-cli/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brianpursley%2Fpgmq-cli/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/brianpursley","download_url":"https://codeload.github.com/brianpursley/pgmq-cli/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brianpursley%2Fpgmq-cli/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31677819,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-11T08:18:19.405Z","status":"ssl_error","status_checked_at":"2026-04-11T08:17:08.892Z","response_time":54,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["cli","golang","pgmq","postgres","postgresql","queues"],"created_at":"2026-04-11T10:38:07.236Z","updated_at":"2026-04-11T10:38:07.822Z","avatar_url":"https://github.com/brianpursley.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# pgmq-cli\n\nA command-line tool to manage [PGMQ (Postgres Message Queue)](https://github.com/pgmq/pgmq) in PostgreSQL.\n\n## Features\n\n- Initialize PGMQ extension\n- Create, list, and drop queues\n- Send and read messages\n- Topic routing with bind, unbind, list, test, and send commands\n- Archive, delete, and purge messages\n- Table or JSON output\n- Config-based server selection\n\n## Requirements\n\n- Postgres with the PGMQ extension available\n- Queue management and queue message commands require `pgmq` 1.7.0 or later\n- Topic routing commands require `pgmq` 1.11.0 or later\n\n## Installation\n\n### Prebuilt binaries\n\nDownload the latest release for your platform from the [releases page](https://github.com/brianpursley/pgmq-cli/releases).\n\n*(If you encounter problems running the downloaded binary check out the [Frequently Asked Questions section](#frequently-asked-questions) below)*\n\n### Build from source\n\n```sh\nmake\n```\n\n### Install from source to your GOPATH\n\n```sh\nmake install\n```\n\n## Shell Completion\n\nGenerate completion scripts with:\n\n```sh\npgmq completion bash\npgmq completion zsh\npgmq completion fish\npgmq completion powershell\n```\n\nExamples:\n\n```sh\n# Bash (current shell)\nsource \u003c(pgmq completion bash)\n\n# Zsh (current shell)\nsource \u003c(pgmq completion zsh)\n\n# Fish\npgmq completion fish \u003e ~/.config/fish/completions/pgmq.fish\n```\n\n## Configuration\n\nCreate a config file at `~/.pgmq/config.json`:\n\n```json\n{\n  \"defaultServer\": \"DevServer\",\n  \"servers\": {\n    \"DevServer\": {\n      \"connectionString\": \"Host=localhost;Username=postgres;Password=postgres;Database=pgmq;\"\n    }\n  }\n}\n```\n\n- `defaultServer` is optional. If omitted, you must pass `--server` on every command.\n- `connectionString` can be a standard Postgres connection string.\n\n## Global Flags\n\n- `--server` / `-s`: Server name (overrides `defaultServer`)\n- `-Y` / `--yes`: Skip confirmation prompts for destructive commands\n- `--config`: Config file path (overrides default)\n\n## Commands\n\n### `pgmq server`\n\nManage servers in `~/.pgmq/config.json`.\n\n```sh\npgmq server add DevServer \"Host=localhost;Username=postgres;Password=postgres;Database=pgmq;\"\npgmq server update DevServer \"Host=localhost;Username=postgres;Password=postgres;Database=pgmq;\"\npgmq server remove DevServer\npgmq server list\npgmq server get DevServer\npgmq server get-default\npgmq server set-default DevServer\npgmq server unset-default\n```\n\n### `pgmq init`\n\nInitialize the PGMQ extension if needed.\n\n```sh\npgmq init\npgmq init --check\n```\n\n### `pgmq create`\n\nCreate a queue.\n\n```sh\npgmq create MyQueue\npgmq create MyQueue --logged=false\n```\n\n### `pgmq list`\n\nList all queues.\n\n```sh\npgmq list\n```\n\n### `pgmq metrics`\n\nGet metrics for a queue, or for all queues if no queue is specified.\n\n```sh\npgmq metrics MyQueue\npgmq metrics\n```\n\n### `pgmq send`\n\nSend a message to a queue.\n\n```sh\npgmq send MyQueue '{\"foo\":\"bar\"}'\npgmq send MyQueue '{\"foo\":\"bar\"}' --headers '{\"x-pgmq-group\":\"user123\"}'\npgmq send MyQueue '{\"foo\":\"bar\"}' --delay 5\npgmq send MyQueue '{\"foo\":\"bar\"}' --delay-until 2025-01-01T12:00:00Z\n```\n\n### `pgmq topic`\n\nManage topic routing. These commands require `pgmq` 1.11.0 or later.\n\nTopic patterns use dot-separated segments:\n\n- `*` matches exactly one segment\n- `#` matches zero or more segments\n\nExamples:\n\n```sh\npgmq topic bind 'logs.#' all_logs\npgmq topic bind 'logs.*.error' error_logs\npgmq topic bind 'logs.api.error' api_errors\n\npgmq topic list\npgmq topic list api_errors\n\npgmq topic test 'logs.api.error'\n\npgmq topic send 'logs.api.error' '{\"message\":\"API failed\"}'\npgmq topic send 'logs.api.error' '{\"message\":\"API failed\"}' --headers '{\"priority\":\"high\"}'\npgmq topic send 'logs.api.error' '{\"message\":\"API failed\"}' --delay 5\npgmq topic send 'logs.api.error' '{\"message\":\"API failed\"}' --delay-until 2025-01-01T12:00:00Z\n\npgmq topic unbind 'logs.api.error' api_errors\n```\n\nNotes:\n\n- `pgmq topic list`, `pgmq topic test`, and `pgmq topic send` support `-o json`\n- `pgmq topic send -o json` returns an array of `{queue_name, msg_id}` objects\n- If a routing key matches no bindings, `pgmq topic send -o json` returns `[]`\n\n### `pgmq read`\n\nRead messages with visibility timeout.\n\n```sh\npgmq read MyQueue --qty 5\n```\n\n### `pgmq pop`\n\nRead and delete messages.\n\n```sh\npgmq pop MyQueue --qty 1\n```\n\nUse `-o message` to output only the raw message JSON.\n\n### `pgmq delete`\n\nDelete messages by ID.\n\n```sh\npgmq delete MyQueue 42\npgmq delete MyQueue 42 43 44\n```\n\n### `pgmq archive`\n\nArchive messages by ID.\n\n```sh\npgmq archive MyQueue 42\npgmq archive MyQueue 42 43 44\n```\n\n### `pgmq purge`\n\nDelete all messages in a queue.\n\n```sh\npgmq purge MyQueue --yes\n```\n\nIf the queue is empty, the command prints `queue is empty`.\n\n### `pgmq drop`\n\nDrop a queue and its archive.\n\n```sh\npgmq drop MyQueue --yes\n```\n\n### `pgmq version`\n\nPrint the binary version.\n\n```sh\npgmq version\n```\n\n## Output Formats\n\nSome commands support different output formats, which can be selected via the `--output` or `-o` flag.\n\n### Table Output (default)\n\nCommands render a simple human-readable table when the output is tabular.\n\n### JSON Output\n\nUse `-o json` to return the output in JSON format.\n\n### Message Output\n\nThe `pgmq pop` command supports `-o message` to output only the raw message JSON. If multiple messages are requested, a JSON array is returned.\n\n## Exit Codes\n\n- `0`: Success\n- `1`: Server/SQL error\n- `2`: Invalid arguments / usage\n- `3`: Not found (e.g., queue missing)\n\n## Frequently Asked Questions\n\n### Why do I get an error saying `\"pgmq\" cannot be opened because the developer cannot be verified` on macOS?\n\nThis is a common issue with unsigned binaries on macOS. To bypass this, you can remove the quarantine attribute from the binary:\n\n```sh\nxattr -d com.apple.quarantine pgmq\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbrianpursley%2Fpgmq-cli","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbrianpursley%2Fpgmq-cli","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbrianpursley%2Fpgmq-cli/lists"}