snout_net
snout_net · Queue asynchronous HTTP requests from PostgreSQL through a background worker
Overview
| ID | Extension | Package | Version | Category | License | Language |
|---|---|---|---|---|---|---|
| 102056 | snout_net | snout_net | 0.1.0 | UTIL | Apache-2.0 | Rust |
PostgreSQL · 17
| Relationships | |
|---|---|
| Requires | plpgsql |
Usage
Sources:
snout_net 0.1.0 queues HTTP requests in PostgreSQL and sends them through a background worker after the submitting transaction commits. It targets PostgreSQL 17 and requires libcurl 7.85 or later. A superuser must preload the library, restart the server and install the extension in the configured database.
Core Workflow
The SQL example uses psql to retain the request ID. The response query can initially return no row; query again after the worker finishes. A rolled-back transaction sends nothing. Do not wait synchronously in the transaction that queued the request.
Objects and Configuration
net.http_get,net.http_post,net.http_delete: return a request ID; accept query parameters, headers and a timeout. The POST helper accepts JSON bodies.net.http_request_queueandnet._http_response: pending requests and recorded responses.net._http_collect_response: collect a response; synchronous waiting belongs in a later transaction.net.check_worker_is_up,net.wait_until_running,net.worker_restart: worker health and restart helpers.snout_net.database_nameselects the one database served;snout_net.usernameselects the worker role (default: bootstrap superuser).snout_net.ttldefaults to 6 hours;snout_net.max_concurrentto 200;snout_net.max_timeout_msto 600000;snout_net.max_response_bytesto 64 MB.snout_net.allowed_networkspermits explicitly listed internal CIDRs. Otherwise private, loopback, link-local and other non-public ranges are rejected, including after DNS resolution and redirects.snout_net.worker_typeis set at server start; the other settings require a configuration reload. Library upgrades require a server restart.
Delivery and Security Boundaries
Both queue and response tables are unlogged: they are not a durable job system across a database crash and are not replicated to physical standbys. A worker restarting mid-request may resend it, so receivers must tolerate duplicate effects. Requests to the same endpoint can arrive out of order. If recording a response fails because of a trigger or constraint, the worker logs a warning and does not resend that request.
The installation grants PUBLIC access to the schema, tables and sequences. Review those privileges, the worker role and outbound-network policy before exposing SQL access. The fixed net objects overlap with pg_net; this is not a side-by-side installation or an automatic migration procedure.