Skip to content

RabbitMQ

RabbitMQ broker state via the Management API, plus non-destructive stream reads

Connector software
Free and open source
Service credentials
Required
Use with an agent

Install the Orchard skill in your project to help your agent find connectors, configure them, and verify SQL results.

npx skills add Query-farm/vgi-skills --skill orchard

Copy this request into your coding agent to get started.

Use https://query.farm/products/orchard/connectors/rabbitmq/index.md to help me query RabbitMQ with DuckDB or Haybarn 2.0.1 and VGI protocol 3.4. Ask only for missing details about the result I need or whether I want local execution, self-hosting or Query Farm hosting. Check the connector's actual hosting availability, credentials and input requirements. Read one format of each needed reference and the exact object declarations before writing SQL. Use a released connector, and distinguish a saved example result from anything you actually execute. If you cannot run the query, tell me what remains to verify.

Check your cluster’s message backlog

Uses your connected account. Set up the connector and credentials to run it with your data.

SELECT cluster_name, rabbitmq_version, messages_ready,
  messages_unacknowledged, queues, connections
FROM rabbitmq.main.overview()

Quick start

Choose where to run RabbitMQ, then follow the steps below.

The connector runs alongside DuckDB or Haybarn. No Query Farm account is needed.

1. Install the vgi extension

Run this in your SQL client. On DuckDB, keep FROM query_farm on LOAD in later sessions.

setup.sql
SET allow_extension_repositories = 'allowed';

CREATE EXTENSION REPOSITORY IF NOT EXISTS query_farm
    WITH PREFIX 'https://duckdb-extensions.query.farm';

INSTALL vgi FROM query_farm;
LOAD vgi FROM query_farm;

2. Attach the connector

Attach the release directly

Downloads the latest release for your platform and caches it locally.

ATTACH 'rabbitmq' AS rabbitmq (
  TYPE vgi,
  LOCATION 'github-auto://Query-farm/vgi-rabbitmq'
);

3. Add service credentials

After attaching, create the secret for the service you want to query in the same SQL session. Replace the placeholders with your service settings.

rabbitmq credentials

Connection to a RabbitMQ broker: the Management HTTP API (basic auth or OAuth 2 bearer token), an optional AMQP URL for stream reads, and TLS options.

Get these credentials →
secret.sql
CREATE SECRET rabbitmq (
    TYPE rabbitmq,
    management_url  '<management_url>',
    username        '<username>',
    password        '<RABBITMQ_PASSWORD>',  -- secret
    bearer_token    '<BEARER_TOKEN>',  -- secret
    amqp_url        '<RABBITMQ_AMQP_URL>',  -- secret
    tls_ca_cert     '<tls_ca_cert>',
    tls_client_cert '<tls_client_cert>',
    tls_client_key  '<TLS_CLIENT_KEY>',  -- secret
    tls_server_name '<tls_server_name>',
    tls_skip_verify '<tls_skip_verify>'
);
Credential fields and requirements →

4. Run a query

query.sql
SELECT cluster_name, rabbitmq_version, messages_ready,
  messages_unacknowledged, queues, connections
FROM rabbitmq.main.overview()
More example queries →
Technical details
Verified connector release
v0.2.0
Engine
2.0.1
VGI protocol
3.4.0
Verified on
December 1, 2026
Release notes on GitHub
Pin a version for production

When running the connector yourself, keep a specific release until you’re ready to upgrade. Replace the ATTACH statement above with this one and follow the same extension and credential setup.

Attach the release directly

Uses the verified release each time you attach the connector.

ATTACH 'rabbitmq' AS rabbitmq (
  TYPE vgi,
  LOCATION 'github-auto://Query-farm/[email protected]'
);

Overview

RabbitMQ broker state as SQL tables through the Management HTTP API (queues, exchanges, bindings, connections, nodes, policies, permissions, health checks) plus non-destructive stream reads.

Catalog

Everything rabbitmq exposes once attached — read straight from the worker's released build.

rabbitmq 1 schema
main 25 functions

One RabbitMQ broker's state through the Management HTTP API, plus non-consuming stream reads and an opt-in queue peek.

Schema examples (25)
Examples (25)

Cluster name, version and message backlog at a glance

SELECT cluster_name, rabbitmq_version, messages_ready,
  messages_unacknowledged, queues, connections
FROM rabbitmq.main.overview();

Resource alarms, memory headroom and partitions per node

SELECT name, mem_alarm, disk_free_alarm,
  round(100.0 * mem_used / mem_limit, 1) AS mem_pct, fd_used,
  len(partitions) AS partitions
FROM rabbitmq.main.nodes()
ORDER BY name;

Virtual hosts ordered by backlog

SELECT name, default_queue_type, messages_ready, messages_unacknowledged
FROM rabbitmq.main.vhosts()
ORDER BY messages_ready DESC NULLS LAST, name;

Queues with a backlog, largest first

SELECT vhost, name, type, messages_ready, messages_unacknowledged, consumers
FROM rabbitmq.main.queues()
WHERE messages_ready > 0
ORDER BY messages_ready DESC, vhost, name;
21 more examples

User-declared exchanges in one vhost

SELECT vhost, name, type
FROM rabbitmq.main.exchanges(vhost := 'shop')
WHERE name NOT LIKE 'amq.%' AND name <> ''
ORDER BY name;

The routing graph of one vhost (default-exchange bindings left out)

SELECT source, routing_key, destination_type, destination
FROM rabbitmq.main.bindings(vhost := 'shop')
WHERE source <> ''
ORDER BY source, destination;

Connections per user and client library

SELECT user, client_product, count(*) AS connections
FROM rabbitmq.main.connections()
GROUP BY ALL
ORDER BY connections DESC, user;

Channels holding unacknowledged messages

SELECT name, user, prefetch_count, messages_unacknowledged
FROM rabbitmq.main.channels()
WHERE messages_unacknowledged > 0
ORDER BY messages_unacknowledged DESC, name;

Consumers and combined prefetch per queue

SELECT vhost, queue, count(*) AS consumers,
  sum(prefetch_count) AS total_prefetch
FROM rabbitmq.main.consumers()
GROUP BY vhost, queue
ORDER BY consumers DESC, vhost, queue;

Administrators

SELECT name, tags
FROM rabbitmq.main.users()
WHERE list_contains(tags, 'administrator')
ORDER BY name;

Users with full permissions on a vhost

SELECT user, vhost
FROM rabbitmq.main.permissions()
WHERE configure = '.*' AND write = '.*' AND read = '.*'
ORDER BY user, vhost;

Routing-key restrictions on topic exchanges

SELECT user, vhost, exchange, write, read
FROM rabbitmq.main.topic_permissions()
ORDER BY user, vhost, exchange;

Policies with their message TTL

SELECT vhost, name, pattern, apply_to, definition['message-ttl'] AS ttl_ms
FROM rabbitmq.main.policies()
ORDER BY vhost, priority DESC, name;

Operator policies (limits users cannot override)

SELECT vhost, name, pattern, definition
FROM rabbitmq.main.operator_policies()
ORDER BY vhost, name;

Dynamic shovels and where they move messages (credentials masked)

SELECT vhost, name,
  json_extract_string(value, '$."src-queue"') AS src_queue,
  json_extract_string(value, '$."dest-uri"') AS dest_uri
FROM rabbitmq.main.parameters(component := 'shovel')
ORDER BY vhost, name;

The cluster name as stored in the global parameters

SELECT name, value
FROM rabbitmq.main.global_parameters()
WHERE name = 'cluster_name';

Shovels that are not running and why

SELECT vhost, name, state, reason
FROM rabbitmq.main.shovels()
WHERE state <> 'running'
ORDER BY vhost, name;

How many of each object the broker's definitions export holds

SELECT object_type, object_count
FROM rabbitmq.main.definitions_summary()
ORDER BY object_type;

Failing health checks and why

SELECT check_name, status, reason
FROM rabbitmq.main.health_checks()
WHERE NOT ok
ORDER BY check_name;

Feature flags not yet enabled (must be enabled before upgrading)

SELECT name, stability
FROM rabbitmq.main.feature_flags()
WHERE state <> 'enabled'
ORDER BY name;

Deprecated features in use that block a future upgrade

SELECT name, deprecation_phase, doc_url
FROM rabbitmq.main.deprecated_features()
WHERE in_use
ORDER BY name;

Read a stream from the beginning without consuming it

SELECT sequence, key, payload_text::JSON->>'order_id' AS order_id,
  headers['tenant'] AS tenant
FROM rabbitmq.main.stream_messages('shop', 'events')
ORDER BY sequence;

Look at the first five messages of a classic queue (re-queues them: opt-in)

SELECT message_id, key, payload_text, headers['trace'] AS trace
FROM rabbitmq.main.peek_messages('shop', 'orders.created', count := 5, peek_requeue := true);

Which destinations a message published to the orders topic exchange with key orders.created.eu reaches

SELECT destination
FROM rabbitmq.main.bindings(vhost := 'shop')
WHERE source = 'orders' AND rabbitmq.main.topic_matches(routing_key, 'orders.created.eu')
ORDER BY destination;

Shovel source URIs with credentials masked (parameters already masks; this works on any text)

SELECT name,
  rabbitmq.main.mask_uri(json_extract_string(value, '$."src-uri"')) AS src
FROM rabbitmq.main.parameters(component := 'shovel')
ORDER BY name;
Scalar functions
mask_uri (uri VARCHAR) 2 examples

Mask passwords in AMQP (or any) URIs and password-like query parameters

Arguments
uri VARCHAR
Text that may contain URIs with credentials, e.g. 'amqp://user:pass@host/vhost'. NULL gives NULL.
ReturnsVARCHAR
Examples (2)

Shovel source URIs with credentials masked (parameters already masks; this works on any text)

SELECT name,
  rabbitmq.main.mask_uri(json_extract_string(value, '$."src-uri"')) AS src
FROM rabbitmq.main.parameters(component := 'shovel')
ORDER BY name;
SELECT rabbitmq.main.mask_uri(u) AS masked
FROM (VALUES ('amqp://app:s3cret@mq:5672/shop'), ('amqps://mq/?password=x&heartbeat=5'), ('amqp://mq')) t(u)
ORDER BY masked;
Link
topic_matches (pattern VARCHAR, routing_key VARCHAR) 2 examples

True when an AMQP topic binding key (with * and # wildcards) matches a routing key

Arguments
pattern VARCHAR
Topic binding key, e.g. 'orders.*.eu' or 'orders.#'. NULL gives NULL.
routing_key VARCHAR
Routing key of a message, e.g. 'orders.created.eu'. NULL gives NULL.
ReturnsBOOLEAN
Examples (2)

Which destinations a message published to the orders topic exchange with key orders.created.eu reaches

SELECT destination
FROM rabbitmq.main.bindings(vhost := 'shop')
WHERE source = 'orders' AND rabbitmq.main.topic_matches(routing_key, 'orders.created.eu')
ORDER BY destination;
SELECT p, rabbitmq.main.topic_matches(p, 'orders.created.eu') AS hit
FROM (VALUES ('orders.*'), ('orders.*.eu'), ('orders.#'), ('#'), ('*.paid')) t(p)
ORDER BY p;
Link
Table functions
bindings (vhost := VARCHAR, secret_name := VARCHAR) 2 examples

Bindings: the routing graph from exchanges to queues and exchanges

Named arguments
vhost := VARCHAR
Only this virtual host (pushed into the API path, e.g. /api/policies/{vhost}); default all vhosts.
secret_name := VARCHAR
Name of the rabbitmq secret to use when several exist.
Returns columns
vhost VARCHAR
Virtual host.
source VARCHAR
Source exchange; '' is the default exchange (every queue's implicit binding).
destination VARCHAR
Destination queue or exchange.
destination_type VARCHAR
'queue' or 'exchange' (exchange-to-exchange binding).
routing_key VARCHAR
Binding key (topic pattern, direct key, or '' for fanout/headers).
arguments MAP(VARCHAR, VARCHAR)
Binding arguments, e.g. x-match for headers exchanges (values as text).
properties_key VARCHAR
The binding's identifier in the API (routing key plus argument hash).
Examples (2)

The routing graph of one vhost (default-exchange bindings left out)

SELECT source, routing_key, destination_type, destination
FROM rabbitmq.main.bindings(vhost := 'shop')
WHERE source <> ''
ORDER BY source, destination;

Queues no exchange routes to (only reachable through the default exchange)

SELECT q.vhost, q.name
FROM rabbitmq.main.queues() q ANTI
JOIN (SELECT vhost, destination FROM rabbitmq.main.bindings() WHERE source <> '' AND destination_type = 'queue') b ON b.vhost = q.vhost AND b.destination = q.name
ORDER BY q.vhost, q.name;
Link
channels (vhost := VARCHAR, name := VARCHAR, use_regex := BOOLEAN, page_size := BIGINT, secret_name := VARCHAR) 2 examples

Channels with prefetch, unacknowledged and unconfirmed messages and rates

Named arguments
vhost := VARCHAR
Only this virtual host (pushed into the API path); default all vhosts.
name := VARCHAR
Name filter pushed to the API: a case-insensitive substring or with use_regex := true a regular expression.
use_regex := BOOLEAN
Treat name as a regular expression (the broker's use_regex=true). · default false
page_size := BIGINT
Objects per API page (the management API caps pages at 500). · default 100
secret_name := VARCHAR
Name of the rabbitmq secret to use when several exist.
Returns columns
vhost VARCHAR
Virtual host.
name VARCHAR
Channel name: '<connection name> (<number>)'.
connection_name VARCHAR
Connection the channel belongs to.
number BIGINT
Channel number within its connection.
user VARCHAR
Authenticated user.
node VARCHAR
Node holding the channel.
state VARCHAR
running, flow, starting or closing.
consumer_count BIGINT
Consumers on the channel.
prefetch_count BIGINT
Per-consumer prefetch (basic.qos); 0 = unlimited.
global_prefetch_count BIGINT
Per-channel prefetch; 0 = unlimited.
messages_unacknowledged BIGINT
Messages delivered on this channel and not yet acknowledged.
messages_unconfirmed BIGINT
Published messages awaiting a publisher confirm.
messages_uncommitted BIGINT
Messages in an open transaction.
confirm BOOLEAN
Publisher confirms enabled.
transactional BOOLEAN
Channel is in transaction mode.
publish_rate DOUBLE
Messages published per second.
deliver_get_rate DOUBLE
Messages delivered per second.
ack_rate DOUBLE
Acknowledgements per second.
idle_since TIMESTAMP WITH TIME ZONE
When the channel went idle; NULL when active.
Examples (2)

Channels holding unacknowledged messages

SELECT name, user, prefetch_count, messages_unacknowledged
FROM rabbitmq.main.channels()
WHERE messages_unacknowledged > 0
ORDER BY messages_unacknowledged DESC, name;

Channels and consumers per vhost

SELECT vhost, count(*) AS channels, sum(consumer_count) AS consumers
FROM rabbitmq.main.channels()
GROUP BY vhost
ORDER BY vhost;
Link
connections (vhost := VARCHAR, name := VARCHAR, use_regex := BOOLEAN, page_size := BIGINT, secret_name := VARCHAR) 2 examples

Client connections with user, client library, TLS, state and traffic

Named arguments
vhost := VARCHAR
Only this virtual host (pushed into the API path); default all vhosts.
name := VARCHAR
Name filter pushed to the API: a case-insensitive substring or with use_regex := true a regular expression.
use_regex := BOOLEAN
Treat name as a regular expression (the broker's use_regex=true). · default false
page_size := BIGINT
Objects per API page (the management API caps pages at 500). · default 100
secret_name := VARCHAR
Name of the rabbitmq secret to use when several exist.
Returns columns
vhost VARCHAR
Virtual host the connection is open on.
name VARCHAR
Connection name, e.g. '172.17.0.1:50412 -> 172.17.0.2:5672'.
user VARCHAR
Authenticated user.
node VARCHAR
Node holding the connection.
state VARCHAR
running, blocking, blocked (by a resource alarm), flow or closing.
protocol VARCHAR
Protocol, e.g. 'AMQP 0-9-1', 'AMQP 1.0', 'MQTT 5-0', 'Stream'.
auth_mechanism VARCHAR
SASL mechanism, e.g. PLAIN or EXTERNAL.
ssl BOOLEAN
Whether the connection uses TLS.
peer_host VARCHAR
Client address.
peer_port BIGINT
Client port.
channels BIGINT
Open channels on the connection.
connected_at TIMESTAMP WITH TIME ZONE
When the connection opened.
client_connection_name VARCHAR
Name the client gave the connection (client_properties.connection_name); NULL when unset.
client_product VARCHAR
Client library product name, e.g. 'RabbitMQ' or 'pika'.
client_version VARCHAR
Client library version.
client_platform VARCHAR
Client platform, e.g. 'Go', 'Python 3.12'.
heartbeat_seconds BIGINT
Negotiated heartbeat timeout in seconds (0 = off).
recv_oct BIGINT
Bytes received.
send_oct BIGINT
Bytes sent.
recv_rate DOUBLE
Bytes received per second.
send_rate DOUBLE
Bytes sent per second.
Examples (2)

Connections per user and client library

SELECT user, client_product, count(*) AS connections
FROM rabbitmq.main.connections()
GROUP BY ALL
ORDER BY connections DESC, user;

Connections blocked by a resource alarm in one vhost

SELECT name, user, state
FROM rabbitmq.main.connections(vhost := 'shop')
WHERE state IN ('blocked', 'blocking')
ORDER BY name;
Link
consumers (vhost := VARCHAR, secret_name := VARCHAR) 2 examples

Consumers with their queue, channel, ack mode, prefetch and activity

Named arguments
vhost := VARCHAR
Only this virtual host (pushed into the API path, e.g. /api/policies/{vhost}); default all vhosts.
secret_name := VARCHAR
Name of the rabbitmq secret to use when several exist.
Returns columns
vhost VARCHAR
Virtual host of the queue.
queue VARCHAR
Queue being consumed.
consumer_tag VARCHAR
Consumer tag.
channel_name VARCHAR
Channel the consumer is on.
connection_name VARCHAR
Connection the consumer is on.
peer_host VARCHAR
Client address.
user VARCHAR
User the consumer authenticated as.
ack_required BOOLEAN
Manual acknowledgement mode (false = auto-ack).
prefetch_count BIGINT
Prefetch limit for this consumer; 0 = unlimited.
exclusive BOOLEAN
Exclusive consumer.
active BOOLEAN
Whether the consumer receives deliveries (false for a waiting single-active consumer).
activity_status VARCHAR
up, waiting or single_active.
arguments MAP(VARCHAR, VARCHAR)
Consumer arguments, e.g. x-stream-offset or x-priority (values as text).
Examples (2)

Consumers and combined prefetch per queue

SELECT vhost, queue, count(*) AS consumers,
  sum(prefetch_count) AS total_prefetch
FROM rabbitmq.main.consumers()
GROUP BY vhost, queue
ORDER BY consumers DESC, vhost, queue;

Each queue's backlog next to who consumes it

SELECT q.name, q.messages_ready, c.consumer_tag, c.prefetch_count
FROM rabbitmq.main.queues(vhost := 'shop') q
LEFT JOIN rabbitmq.main.consumers(vhost := 'shop') c ON c.queue = q.name
ORDER BY q.name, c.consumer_tag;
Link
definitions_summary (vhost := VARCHAR, secret_name := VARCHAR) 2 examples

Object counts in the broker's definitions export, optionally for one vhost

Named arguments
vhost := VARCHAR
Only this virtual host (pushed into the API path, e.g. /api/policies/{vhost}); default all vhosts.
secret_name := VARCHAR
Name of the rabbitmq secret to use when several exist.
Returns columns
object_type VARCHAR
Definition section: users, vhosts, permissions, topic_permissions, parameters, global_parameters, policies, queues, exchanges, bindings.
object_count BIGINT
Number of objects of that type in the exported definitions.
Examples (2)

How many of each object the broker's definitions export holds

SELECT object_type, object_count
FROM rabbitmq.main.definitions_summary()
ORDER BY object_type;

Object counts for one vhost's definitions

SELECT object_type, object_count
FROM rabbitmq.main.definitions_summary(vhost := 'shop')
WHERE object_count > 0
ORDER BY object_count DESC, object_type;
Link
deprecated_features (secret_name := VARCHAR) 2 examples

Deprecated features, their phase and whether they are in use

Named arguments
secret_name := VARCHAR
Name of the rabbitmq secret to use when several exist.
Returns columns
name VARCHAR
Deprecated feature name, e.g. 'transient_nonexcl_queues'.
deprecation_phase VARCHAR
permitted_by_default, denied_by_default, disconnected or removed.
state VARCHAR
Whether the feature is currently permitted or denied on this broker.
description VARCHAR
What the feature is.
doc_url VARCHAR
Documentation link; NULL when none.
provided_by VARCHAR
Application that defines the feature.
in_use BOOLEAN
true when something on the broker uses the feature right now (/api/deprecated-features/used).
Examples (2)

Deprecated features in use that block a future upgrade

SELECT name, deprecation_phase, doc_url
FROM rabbitmq.main.deprecated_features()
WHERE in_use
ORDER BY name;

Deprecated features by phase

SELECT deprecation_phase, count(*) AS features
FROM rabbitmq.main.deprecated_features()
GROUP BY deprecation_phase
ORDER BY deprecation_phase;
Link
exchanges (vhost := VARCHAR, name := VARCHAR, use_regex := BOOLEAN, page_size := BIGINT, secret_name := VARCHAR) 2 examples

Exchanges with type, flags, arguments and publish rates; vhost and name filters push down

Named arguments
vhost := VARCHAR
Only this virtual host (pushed into the API path); default all vhosts.
name := VARCHAR
Name filter pushed to the API: a case-insensitive substring or with use_regex := true a regular expression.
use_regex := BOOLEAN
Treat name as a regular expression (the broker's use_regex=true). · default false
page_size := BIGINT
Objects per API page (the management API caps pages at 500). · default 100
secret_name := VARCHAR
Name of the rabbitmq secret to use when several exist.
Returns columns
vhost VARCHAR
Virtual host.
name VARCHAR
Exchange name; '' is the default exchange.
type VARCHAR
direct, fanout, topic, headers, or a plugin type (x-...).
durable BOOLEAN
Survives a broker restart.
auto_delete BOOLEAN
Deleted when its last binding is removed.
internal BOOLEAN
Clients cannot publish to it directly (exchange-to-exchange only).
arguments MAP(VARCHAR, VARCHAR)
Declared arguments, e.g. alternate-exchange (values as text).
policy VARCHAR
Policy applied to the exchange; NULL when none.
publish_in BIGINT
Messages published into the exchange (since stats reset).
publish_out BIGINT
Messages routed out of the exchange.
publish_in_rate DOUBLE
Messages published in per second.
publish_out_rate DOUBLE
Messages routed out per second.
Examples (2)

User-declared exchanges in one vhost

SELECT vhost, name, type
FROM rabbitmq.main.exchanges(vhost := 'shop')
WHERE name NOT LIKE 'amq.%' AND name <> ''
ORDER BY name;

Exchanges by type

SELECT type, count(*) AS exchanges
FROM rabbitmq.main.exchanges()
GROUP BY type
ORDER BY exchanges DESC, type;
Link
feature_flags (secret_name := VARCHAR) 2 examples

Feature flags with state and stability (upgrade readiness)

Named arguments
secret_name := VARCHAR
Name of the rabbitmq secret to use when several exist.
Returns columns
name VARCHAR
Feature flag name.
state VARCHAR
enabled, disabled or state_changing.
stability VARCHAR
required, stable or experimental.
description VARCHAR
What the flag enables.
doc_url VARCHAR
Documentation link; NULL when none.
provided_by VARCHAR
Application that defines the flag, e.g. 'rabbit'.
Examples (2)

Feature flags not yet enabled (must be enabled before upgrading)

SELECT name, stability
FROM rabbitmq.main.feature_flags()
WHERE state <> 'enabled'
ORDER BY name;

Feature flags by stability and state

SELECT stability, state, count(*) AS flags
FROM rabbitmq.main.feature_flags()
GROUP BY ALL
ORDER BY stability, state;
Link
global_parameters (secret_name := VARCHAR) 2 examples

Cluster-wide runtime parameters such as cluster_name

Named arguments
secret_name := VARCHAR
Name of the rabbitmq secret to use when several exist.
Returns columns
name VARCHAR
Global parameter name, e.g. 'cluster_name' or 'internal_cluster_id'.
value VARCHAR
Value as JSON, with URI passwords and credential-named keys masked.
Examples (2)

The cluster name as stored in the global parameters

SELECT name, value
FROM rabbitmq.main.global_parameters()
WHERE name = 'cluster_name';

Every global parameter's name

SELECT name FROM rabbitmq.main.global_parameters() ORDER BY name;
Link
health_checks (cert_within := BIGINT, cert_unit := VARCHAR, secret_name := VARCHAR) 2 examples

Run the broker's health checks (alarms, certificate expiry, quorum criticality, readiness)

Named arguments
cert_within := BIGINT
certificate_expiration fails when a listener certificate expires within this many cert_unit. · default 1
cert_unit := VARCHAR
Unit of cert_within. · default "months"
secret_name := VARCHAR
Name of the rabbitmq secret to use when several exist.
Returns columns
check_name VARCHAR
Check name: alarms, local_alarms, certificate_expiration, node_is_quorum_critical, virtual_hosts, is_in_service, below_node_connection_limit, ready_to_serve_clients.
ok BOOLEAN
true when the check passed (HTTP 200).
status VARCHAR
The check's status: 'ok' or 'failed'.
reason VARCHAR
Why the check failed (or a note when it passed, e.g. 'single node cluster'); NULL otherwise.
http_status BIGINT
HTTP status of the check endpoint (200 ok, 503 failed).
details VARCHAR
The full check response as JSON (alarm lists, expiring certificates, critical queues).
Examples (2)

Failing health checks and why

SELECT check_name, status, reason
FROM rabbitmq.main.health_checks()
WHERE NOT ok
ORDER BY check_name;

One healthy/unhealthy verdict, with certificates checked 30 days ahead

SELECT bool_and(ok) AS healthy, count(*) FILTER (WHERE NOT ok) AS failing
FROM rabbitmq.main.health_checks(cert_within := 30, cert_unit := 'days');
Link
nodes (secret_name := VARCHAR) 2 examples

Cluster nodes with memory, disk and file-descriptor usage, alarms and partitions

Named arguments
secret_name := VARCHAR
Name of the rabbitmq secret to use when several exist.
Returns columns
name VARCHAR
Node name, e.g. 'rabbit@host'.
type VARCHAR
Node type ('disc' or 'ram').
running BOOLEAN
Whether the node is running.
uptime_ms BIGINT
Milliseconds since the node started.
mem_used BIGINT
Memory in use, bytes.
mem_limit BIGINT
Memory high watermark, bytes; publishers block above it.
mem_alarm BOOLEAN
Whether the memory alarm is in effect (publishers blocked).
disk_free BIGINT
Free disk space, bytes.
disk_free_limit BIGINT
Free-disk low watermark, bytes.
disk_free_alarm BOOLEAN
Whether the disk alarm is in effect (publishers blocked).
fd_used BIGINT
File descriptors in use.
fd_total BIGINT
File descriptors available.
sockets_used BIGINT
Sockets in use.
sockets_total BIGINT
Sockets available.
proc_used BIGINT
Erlang processes in use.
proc_total BIGINT
Erlang process limit.
processors BIGINT
CPU cores the runtime sees.
run_queue BIGINT
Erlang scheduler run queue length.
partitions VARCHAR[]
Nodes this node cannot see (network partition); empty when healthy.
being_drained BOOLEAN
Whether the node is in maintenance mode.
rabbitmq_version VARCHAR
RabbitMQ version on this node.
erlang_version VARCHAR
Erlang/OTP version on this node.
enabled_plugins VARCHAR[]
Plugins enabled on this node.
Examples (2)

Resource alarms, memory headroom and partitions per node

SELECT name, mem_alarm, disk_free_alarm,
  round(100.0 * mem_used / mem_limit, 1) AS mem_pct, fd_used,
  len(partitions) AS partitions
FROM rabbitmq.main.nodes()
ORDER BY name;

Nodes that need attention

SELECT name
FROM rabbitmq.main.nodes()
WHERE mem_alarm OR disk_free_alarm OR len(partitions) > 0 OR NOT running
ORDER BY name;
Link
operator_policies (vhost := VARCHAR, secret_name := VARCHAR) 2 examples

Operator policies (operator-enforced limits) with pattern, target, priority and definition

Named arguments
vhost := VARCHAR
Only this virtual host (pushed into the API path, e.g. /api/policies/{vhost}); default all vhosts.
secret_name := VARCHAR
Name of the rabbitmq secret to use when several exist.
Returns columns
vhost VARCHAR
Virtual host.
name VARCHAR
Policy name.
pattern VARCHAR
Regular expression matched against queue/exchange names.
apply_to VARCHAR
queues, exchanges, all, classic_queues, quorum_queues or streams.
priority BIGINT
Priority; the highest-priority matching policy wins.
definition MAP(VARCHAR, VARCHAR)
Policy keys and values, e.g. definition['message-ttl'] (values as text).
Examples (2)

Operator policies (limits users cannot override)

SELECT vhost, name, pattern, definition
FROM rabbitmq.main.operator_policies()
ORDER BY vhost, name;

Operator policies per vhost

SELECT vhost, count(*) AS operator_policies
FROM rabbitmq.main.operator_policies()
GROUP BY vhost
ORDER BY vhost;
Link
overview (secret_name := VARCHAR) 2 examples

Cluster-wide summary: versions, message totals, rates and object counts

Named arguments
secret_name := VARCHAR
Name of the rabbitmq secret to use when several exist.
Returns columns
cluster_name VARCHAR
Cluster name (set with rabbitmqctl set_cluster_name).
node VARCHAR
The node that answered the request, e.g. 'rabbit@host'.
rabbitmq_version VARCHAR
RabbitMQ server version, e.g. '4.1.0'.
erlang_version VARCHAR
Erlang/OTP version.
management_version VARCHAR
Management plugin version.
product_name VARCHAR
Product name ('RabbitMQ' or a distribution's name).
product_version VARCHAR
Product version.
rates_mode VARCHAR
Statistics rates mode: none, basic or detailed.
default_queue_type VARCHAR
Cluster default queue type for new queues (classic, quorum, stream).
messages BIGINT
Messages in all queues (ready + unacknowledged).
messages_ready BIGINT
Messages ready for delivery in all queues.
messages_unacknowledged BIGINT
Messages delivered and awaiting acknowledgement.
publish_rate DOUBLE
Messages published per second (recent sample).
deliver_get_rate DOUBLE
Messages delivered or fetched per second.
ack_rate DOUBLE
Acknowledgements per second.
connections BIGINT
Open client connections.
channels BIGINT
Open channels.
exchanges BIGINT
Exchanges (all vhosts).
queues BIGINT
Queues (all vhosts).
consumers BIGINT
Consumers (all vhosts).
listeners VARCHAR[]
Listening protocols and ports as 'protocol:port@node'.
Examples (2)

Cluster name, version and message backlog at a glance

SELECT cluster_name, rabbitmq_version, messages_ready,
  messages_unacknowledged, queues, connections
FROM rabbitmq.main.overview();

Server and Erlang versions plus how many listeners are open

SELECT rabbitmq_version, erlang_version, len(listeners) AS listener_count
FROM rabbitmq.main.overview()
ORDER BY rabbitmq_version;
Link
parameters (component := VARCHAR, vhost := VARCHAR, secret_name := VARCHAR) 2 examples

Runtime parameters (shovels, federation upstreams, limits) with credentials masked

Named arguments
component := VARCHAR
Only this component (pushed into the path), e.g. 'shovel' or 'federation-upstream'.
vhost := VARCHAR
Only this virtual host (needs component); pushed into the path.
secret_name := VARCHAR
Name of the rabbitmq secret to use when several exist.
Returns columns
vhost VARCHAR
Virtual host.
component VARCHAR
Component: shovel, federation-upstream, federation-upstream-set, vhost-limits, ...
name VARCHAR
Parameter name.
value VARCHAR
Parameter value as JSON, with every URI password, password query parameter and credential-named key replaced by '****'.
Examples (2)

Dynamic shovels and where they move messages (credentials masked)

SELECT vhost, name,
  json_extract_string(value, '$."src-queue"') AS src_queue,
  json_extract_string(value, '$."dest-uri"') AS dest_uri
FROM rabbitmq.main.parameters(component := 'shovel')
ORDER BY vhost, name;

Runtime parameters by component

SELECT component, count(*) AS parameters
FROM rabbitmq.main.parameters()
GROUP BY component
ORDER BY component;
Link
peek_messages (vhost VARCHAR, queue VARCHAR, count := BIGINT, peek_requeue := BOOLEAN, truncate := BIGINT, secret_name := VARCHAR) 2 examples

Fetch and re-queue messages from a classic or quorum queue (opt-in: peek_requeue := true)

Positional arguments
vhost VARCHAR
Virtual host of the queue.
queue VARCHAR
Classic or quorum queue to peek.
Named arguments
count := BIGINT
Messages to fetch from the head of the queue. · default 10
peek_requeue := BOOLEAN
Required opt-in: true acknowledges that fetched messages are re-queued, which marks them redelivered and can change their order. · default false
truncate := BIGINT
Return at most this many bytes of each body (payload_bytes still gives the full size). · default 50000
secret_name := VARCHAR
Name of the rabbitmq secret to use when several exist.
Returns columns
vhost VARCHAR
Virtual host of the queue or stream.
queue VARCHAR
Queue or stream the message was read from.
sequence BIGINT
Position of the message in its source: the stream offset (stream_messages); NULL for peek_messages, whose queues have no stable position.
timestamp TIMESTAMP WITH TIME ZONE
The AMQP timestamp property set by the publisher; NULL when unset.
key VARCHAR
Routing key the message was published with.
exchange VARCHAR
Exchange the message was published to ('' = default exchange).
payload BLOB
Message body bytes (truncated to the truncate argument in peek_messages).
payload_text VARCHAR
The body as text when it is valid UTF-8, else NULL. Parse JSON bodies with payload_text::JSON.
payload_bytes BIGINT
Full body size in bytes (before any truncation).
headers MAP(VARCHAR, VARCHAR)
AMQP headers (values as text; nested tables as JSON).
redelivered BOOLEAN
Whether the broker had delivered the message before.
content_type VARCHAR
content_type property, e.g. 'application/json'.
content_encoding VARCHAR
content_encoding property, e.g. 'gzip'.
message_id VARCHAR
message_id property.
correlation_id VARCHAR
correlation_id property.
reply_to VARCHAR
reply_to property.
message_type VARCHAR
type property (application message type).
app_id VARCHAR
app_id property.
user_id VARCHAR
user_id property (validated by the broker when set).
priority BIGINT
priority property.
delivery_mode BIGINT
delivery_mode property: 1 transient, 2 persistent.
expiration VARCHAR
expiration property (per-message TTL in milliseconds, as text).
Examples (2)

Look at the first five messages of a classic queue (re-queues them: opt-in)

SELECT message_id, key, payload_text, headers['trace'] AS trace
FROM rabbitmq.main.peek_messages('shop', 'orders.created', count := 5, peek_requeue := true);

What kinds of messages sit in a dead-letter queue

SELECT content_type, count(*) AS messages, max(payload_bytes) AS largest
FROM rabbitmq.main.peek_messages('shop', 'orders.dlq', count := 100, peek_requeue := true)
GROUP BY content_type
ORDER BY messages DESC;
Link
permissions (vhost := VARCHAR, secret_name := VARCHAR) 2 examples

Configure, write and read permission regexes per user and vhost

Named arguments
vhost := VARCHAR
Only this virtual host (pushed into the API path, e.g. /api/policies/{vhost}); default all vhosts.
secret_name := VARCHAR
Name of the rabbitmq secret to use when several exist.
Returns columns
user VARCHAR
User name.
vhost VARCHAR
Virtual host.
configure VARCHAR
Regex of resource names the user may declare/delete.
write VARCHAR
Regex of resource names the user may publish to / bind from.
read VARCHAR
Regex of resource names the user may consume from / bind to.
Examples (2)

Users with full permissions on a vhost

SELECT user, vhost
FROM rabbitmq.main.permissions()
WHERE configure = '.*' AND write = '.*' AND read = '.*'
ORDER BY user, vhost;

Who can do what in one vhost

SELECT user, configure, write, read
FROM rabbitmq.main.permissions(vhost := 'shop')
ORDER BY user;
Link
policies (vhost := VARCHAR, secret_name := VARCHAR) 2 examples

User policies with pattern, target, priority and definition

Named arguments
vhost := VARCHAR
Only this virtual host (pushed into the API path, e.g. /api/policies/{vhost}); default all vhosts.
secret_name := VARCHAR
Name of the rabbitmq secret to use when several exist.
Returns columns
vhost VARCHAR
Virtual host.
name VARCHAR
Policy name.
pattern VARCHAR
Regular expression matched against queue/exchange names.
apply_to VARCHAR
queues, exchanges, all, classic_queues, quorum_queues or streams.
priority BIGINT
Priority; the highest-priority matching policy wins.
definition MAP(VARCHAR, VARCHAR)
Policy keys and values, e.g. definition['message-ttl'] (values as text).
Examples (2)

Policies with their message TTL

SELECT vhost, name, pattern, apply_to, definition['message-ttl'] AS ttl_ms
FROM rabbitmq.main.policies()
ORDER BY vhost, priority DESC, name;

Which queues each policy applies to

SELECT p.name AS policy, q.name AS queue
FROM rabbitmq.main.policies(vhost := 'shop') p
JOIN rabbitmq.main.queues(vhost := 'shop') q ON q.policy = p.name
ORDER BY p.name, q.name;
Link
queues (vhost := VARCHAR, name := VARCHAR, use_regex := BOOLEAN, page_size := BIGINT, secret_name := VARCHAR) 3 examples

Queues with depth, consumers, rates, type, policy and arguments; vhost and name filters push down

Named arguments
vhost := VARCHAR
Only this virtual host (pushed into the API path); default all vhosts.
name := VARCHAR
Name filter pushed to the API: a case-insensitive substring or with use_regex := true a regular expression.
use_regex := BOOLEAN
Treat name as a regular expression (the broker's use_regex=true). · default false
page_size := BIGINT
Objects per API page (the management API caps pages at 500). · default 100
secret_name := VARCHAR
Name of the rabbitmq secret to use when several exist.
Returns columns
vhost VARCHAR
Virtual host.
name VARCHAR
Queue name.
type VARCHAR
Queue type: classic, quorum or stream.
state VARCHAR
running, idle, flow, down, minority, ...
durable BOOLEAN
Survives a broker restart.
auto_delete BOOLEAN
Deleted when its last consumer unsubscribes.
exclusive BOOLEAN
Owned by one connection.
node VARCHAR
Node hosting the queue (the leader for quorum queues and streams).
members VARCHAR[]
Replica nodes of a quorum queue or stream; NULL for classic queues.
policy VARCHAR
Name of the policy applied to the queue; NULL when none.
operator_policy VARCHAR
Name of the operator policy applied; NULL when none.
effective_policy_definition MAP(VARCHAR, VARCHAR)
The merged policy settings in effect (values as text).
arguments MAP(VARCHAR, VARCHAR)
Declared x-arguments, e.g. arguments['x-queue-type'] (values as text).
messages BIGINT
Messages in the queue (ready + unacknowledged); for streams, messages stored.
messages_ready BIGINT
Messages ready for delivery: the backlog consumers have not received (the queue's lag).
messages_unacknowledged BIGINT
Messages delivered and not yet acknowledged (in flight).
message_bytes BIGINT
Bytes of message bodies in the queue.
consumers BIGINT
Number of consumers.
consumer_capacity DOUBLE
Fraction of time the queue could deliver to consumers immediately (0 to 1).
publish_rate DOUBLE
Messages published per second into the queue.
deliver_get_rate DOUBLE
Messages delivered or fetched per second.
ack_rate DOUBLE
Acknowledgements per second.
redeliver_rate DOUBLE
Redeliveries per second.
memory BIGINT
Bytes of memory used by the queue process.
head_message_timestamp TIMESTAMP WITH TIME ZONE
AMQP timestamp of the oldest message (classic queues; needs publishers to set it).
first_timestamp TIMESTAMP WITH TIME ZONE
Timestamp of the oldest message still stored in a stream.
idle_since TIMESTAMP WITH TIME ZONE
When the queue went idle; NULL when active.
delivery_limit BIGINT
Quorum queue delivery limit (poison-message handling); NULL otherwise.
Examples (3)

Queues with a backlog, largest first

SELECT vhost, name, type, messages_ready, messages_unacknowledged, consumers
FROM rabbitmq.main.queues()
WHERE messages_ready > 0
ORDER BY messages_ready DESC, vhost, name;

Order queues in the shop vhost (vhost and regex pushed to the API) with their dead-letter exchange

SELECT name, type, arguments['x-dead-letter-exchange'] AS dlx, policy
FROM rabbitmq.main.queues(vhost := 'shop', name := '^orders\.', use_regex := true)
ORDER BY name;

Queues piling up with no consumer

SELECT vhost, name
FROM rabbitmq.main.queues()
WHERE consumers = 0 AND messages_ready > 0
ORDER BY vhost, name;
Link
shovels (vhost := VARCHAR, secret_name := VARCHAR) 2 examples

Runtime status of shovels: state, reason and endpoints (credentials masked)

Named arguments
vhost := VARCHAR
Only this virtual host (pushed into the API path, e.g. /api/policies/{vhost}); default all vhosts.
secret_name := VARCHAR
Name of the rabbitmq secret to use when several exist.
Returns columns
vhost VARCHAR
Virtual host of the shovel.
name VARCHAR
Shovel name.
type VARCHAR
'dynamic' (a runtime parameter) or 'static' (configuration file).
state VARCHAR
starting, running, blocked or terminated.
reason VARCHAR
Why a shovel is blocked or terminated; NULL otherwise.
node VARCHAR
Node running the shovel.
since TIMESTAMP WITH TIME ZONE
When the shovel entered its state.
src_uri VARCHAR
Source URI (credentials masked); NULL unless running.
src_queue VARCHAR
Source queue (or exchange) name; NULL unless running.
dest_uri VARCHAR
Destination URI (credentials masked); NULL unless running.
dest_queue VARCHAR
Destination queue (or exchange) name; NULL unless running.
Examples (2)

Shovels that are not running and why

SELECT vhost, name, state, reason
FROM rabbitmq.main.shovels()
WHERE state <> 'running'
ORDER BY vhost, name;

Shovels by state

SELECT state, count(*) AS shovels
FROM rabbitmq.main.shovels()
GROUP BY state
ORDER BY state;
Link
stream_messages (vhost VARCHAR, stream VARCHAR, start_offset := VARCHAR, start_timestamp := TIMESTAMP WITH TIME ZONE, max_messages := BIGINT, batch_size := BIGINT, idle_timeout_ms := BIGINT, secret_name := VARCHAR) 2 examples

Read a stream's messages from an offset or time without consuming them (non-destructive)

Positional arguments
vhost VARCHAR
Virtual host of the stream, e.g. '/'.
stream VARCHAR
Stream (queue of type stream) to read.
Named arguments
start_offset := VARCHAR
Where to start: 'first' (oldest retained), 'last' (start of the last chunk), 'next' (only new messages) or a numeric stream offset. · default "first"
start_timestamp := TIMESTAMP WITH TIME ZONE
Start at the first chunk published at or after this time (overrides start_offset).
max_messages := BIGINT
Stop after this many messages. · default 1000
batch_size := BIGINT
Messages read per batch (and AMQP prefetch); one connection per batch. · default 500
idle_timeout_ms := BIGINT
End the scan when no message arrives for this long (the tail of the stream). · default 1000
secret_name := VARCHAR
Name of the rabbitmq secret to use when several exist.
Returns columns
vhost VARCHAR
Virtual host of the queue or stream.
queue VARCHAR
Queue or stream the message was read from.
sequence BIGINT
Position of the message in its source: the stream offset (stream_messages); NULL for peek_messages, whose queues have no stable position.
timestamp TIMESTAMP WITH TIME ZONE
The AMQP timestamp property set by the publisher; NULL when unset.
key VARCHAR
Routing key the message was published with.
exchange VARCHAR
Exchange the message was published to ('' = default exchange).
payload BLOB
Message body bytes (truncated to the truncate argument in peek_messages).
payload_text VARCHAR
The body as text when it is valid UTF-8, else NULL. Parse JSON bodies with payload_text::JSON.
payload_bytes BIGINT
Full body size in bytes (before any truncation).
headers MAP(VARCHAR, VARCHAR)
AMQP headers (values as text; nested tables as JSON).
redelivered BOOLEAN
Whether the broker had delivered the message before.
content_type VARCHAR
content_type property, e.g. 'application/json'.
content_encoding VARCHAR
content_encoding property, e.g. 'gzip'.
message_id VARCHAR
message_id property.
correlation_id VARCHAR
correlation_id property.
reply_to VARCHAR
reply_to property.
message_type VARCHAR
type property (application message type).
app_id VARCHAR
app_id property.
user_id VARCHAR
user_id property (validated by the broker when set).
priority BIGINT
priority property.
delivery_mode BIGINT
delivery_mode property: 1 transient, 2 persistent.
expiration VARCHAR
expiration property (per-message TTL in milliseconds, as text).
Examples (2)

Read a stream from the beginning without consuming it

SELECT sequence, key, payload_text::JSON->>'order_id' AS order_id,
  headers['tenant'] AS tenant
FROM rabbitmq.main.stream_messages('shop', 'events')
ORDER BY sequence;

Message counts per routing key from offset 2 on

SELECT key, count(*) AS messages, sum(payload_bytes) AS bytes
FROM rabbitmq.main.stream_messages('shop', 'events', start_offset := '2', max_messages := 100000)
GROUP BY key
ORDER BY messages DESC, key;
Link
topic_permissions (vhost := VARCHAR, secret_name := VARCHAR) 2 examples

Routing-key permissions on topic exchanges per user and vhost

Named arguments
vhost := VARCHAR
Only this virtual host (pushed into the API path, e.g. /api/policies/{vhost}); default all vhosts.
secret_name := VARCHAR
Name of the rabbitmq secret to use when several exist.
Returns columns
user VARCHAR
User name.
vhost VARCHAR
Virtual host.
exchange VARCHAR
Topic exchange the permission applies to.
write VARCHAR
Regex of routing keys the user may publish with.
read VARCHAR
Regex of routing keys the user may bind with.
Examples (2)

Routing-key restrictions on topic exchanges

SELECT user, vhost, exchange, write, read
FROM rabbitmq.main.topic_permissions()
ORDER BY user, vhost, exchange;

How many users are restricted on each topic exchange

SELECT exchange, count(*) AS users
FROM rabbitmq.main.topic_permissions(vhost := 'shop')
GROUP BY exchange
ORDER BY exchange;
Link
users (secret_name := VARCHAR) 2 examples

Internal users with tags and limits (no password hashes)

Named arguments
secret_name := VARCHAR
Name of the rabbitmq secret to use when several exist.
Returns columns
name VARCHAR
User name.
tags VARCHAR[]
Management tags: administrator, monitoring, policymaker, management, impersonator.
has_password BOOLEAN
Whether the user has a password set (the hash itself is never returned).
hashing_algorithm VARCHAR
Password hashing algorithm, e.g. rabbit_password_hashing_sha256.
limits MAP(VARCHAR, VARCHAR)
Per-user limits, e.g. limits['max-connections'] (values as text).
Examples (2)

Administrators

SELECT name, tags
FROM rabbitmq.main.users()
WHERE list_contains(tags, 'administrator')
ORDER BY name;

Users with no permission on any vhost

SELECT u.name
FROM rabbitmq.main.users() u ANTI
JOIN rabbitmq.main.permissions() p ON p.user = u.name
ORDER BY u.name;
Link
vhosts (secret_name := VARCHAR) 2 examples

Virtual hosts with metadata, per-node state and message totals

Named arguments
secret_name := VARCHAR
Name of the rabbitmq secret to use when several exist.
Returns columns
name VARCHAR
Virtual host name ('/' is the default vhost).
description VARCHAR
Description from the vhost metadata.
tags VARCHAR[]
Vhost tags.
default_queue_type VARCHAR
Queue type new queues get when they do not set x-queue-type.
tracing BOOLEAN
Whether the firehose tracer is on.
protected_from_deletion BOOLEAN
Whether the vhost is protected from deletion.
cluster_state MAP(VARCHAR, VARCHAR)
Per-node state of the vhost, e.g. {'rabbit@host': 'running'}.
messages BIGINT
Messages in the vhost's queues.
messages_ready BIGINT
Ready messages in the vhost's queues.
messages_unacknowledged BIGINT
Unacknowledged messages in the vhost's queues.
publish_rate DOUBLE
Messages published per second into the vhost.
deliver_get_rate DOUBLE
Messages delivered or fetched per second.
Examples (2)

Virtual hosts ordered by backlog

SELECT name, default_queue_type, messages_ready, messages_unacknowledged
FROM rabbitmq.main.vhosts()
ORDER BY messages_ready DESC NULLS LAST, name;

Vhosts that are not running on every node

SELECT name, map_keys(cluster_state) AS nodes
FROM rabbitmq.main.vhosts()
WHERE len(list_filter(map_values(cluster_state), lambda s: s <> 'running')) > 0
ORDER BY name;
Link

Credentials

The secret type rabbitmq declares, as reported by the worker itself.

rabbitmq

How to get these credentials

Connection to a RabbitMQ broker: the Management HTTP API (basic auth or OAuth 2 bearer token), an optional AMQP URL for stream reads, and TLS options.

secret.sql
CREATE SECRET rabbitmq (
    TYPE rabbitmq,
    management_url  '<management_url>',
    username        '<username>',
    password        '<RABBITMQ_PASSWORD>',  -- secret
    bearer_token    '<BEARER_TOKEN>',  -- secret
    amqp_url        '<RABBITMQ_AMQP_URL>',  -- secret
    tls_ca_cert     '<tls_ca_cert>',
    tls_client_cert '<tls_client_cert>',
    tls_client_key  '<TLS_CLIENT_KEY>',  -- secret
    tls_server_name '<tls_server_name>',
    tls_skip_verify '<tls_skip_verify>'
);
Key Type Required Description
management_url VARCHAR — Management plugin root, e.g. 'http://localhost:15672' or 'https://rabbit.example.com/rabbitmq' behind a path prefix. /api/... is appended.
username VARCHAR — Basic-auth user name for the Management API (and for AMQP when amqp_url has no user).
password secret VARCHAR — Basic-auth password.
bearer_token secret VARCHAR — OAuth 2 access token, sent as 'Authorization: Bearer <token>' (rabbitmq_auth_backend_oauth2); for AMQP it is sent as the password.
amqp_url secret VARCHAR — AMQP 0-9-1 URL used by stream_messages, e.g. 'amqp://user:pass@localhost:5672/' or 'amqps://...'. The vhost argument overrides its path.
tls_ca_cert VARCHAR — PEM CA bundle that signs the broker's certificate (HTTPS and AMQPS).
tls_client_cert VARCHAR — PEM client certificate for mutual TLS.
tls_client_key secret VARCHAR — PEM private key of tls_client_cert.
tls_server_name VARCHAR — Server name to verify instead of the URL's host.
tls_skip_verify VARCHAR — 'true' disables certificate verification (testing only).

The worker doesn't mark which keys are required.

Needed by bindingschannelsconnectionsconsumersdefinitions_summarydeprecated_featuresexchangesfeature_flagsglobal_parametershealth_checksnodesoperator_policies and 11 more functions

Create the secret in the same session, after attaching rabbitmq — the worker registers its secret types at ATTACH. Keys marked secret are masked in duckdb_secrets(); angle-bracket values are placeholders. Read credentials from your environment or secret store in your application and pass them through your SQL client’s parameter bindings. Keep real values out of saved SQL and history. Native DuckDB and Haybarn do not provide a SQL getenv() function.

Try these queries

Resource alarms, memory headroom and partitions per node

SELECT name, mem_alarm, disk_free_alarm,
  round(100.0 * mem_used / mem_limit, 1) AS mem_pct, fd_used,
  len(partitions) AS partitions
FROM rabbitmq.main.nodes()
ORDER BY name

Uses nodes

Virtual hosts ordered by backlog

SELECT name, default_queue_type, messages_ready, messages_unacknowledged
FROM rabbitmq.main.vhosts()
ORDER BY messages_ready DESC NULLS LAST, name

Uses vhosts

Queues with a backlog, largest first

SELECT vhost, name, type, messages_ready, messages_unacknowledged, consumers
FROM rabbitmq.main.queues()
WHERE messages_ready > 0
ORDER BY messages_ready DESC, vhost, name

Uses queues

User-declared exchanges in one vhost

SELECT vhost, name, type
FROM rabbitmq.main.exchanges(vhost := 'shop')
WHERE name NOT LIKE 'amq.%' AND name <> ''
ORDER BY name

Uses exchanges

The routing graph of one vhost (default-exchange bindings left out)

SELECT source, routing_key, destination_type, destination
FROM rabbitmq.main.bindings(vhost := 'shop')
WHERE source <> ''
ORDER BY source, destination

Uses bindings

Connections per user and client library

SELECT user, client_product, count(*) AS connections
FROM rabbitmq.main.connections()
GROUP BY ALL
ORDER BY connections DESC, user

Uses connections

44 more examples in the Catalog, each listed under the table or function it uses.

Questions it can answer

Plain-English questions from the worker's agent test tasks. An AI agent with this catalog attached should answer each one with SQL.

  • Which queues in the shop vhost have messages ready, and how many each?
  • How many queues of each type (classic, quorum, stream) does the broker have?
  • Which queues and exchanges does the 'orders' exchange in vhost 'shop' route to, and with which routing keys?
  • Which RabbitMQ users are administrators?
  • Where does the shovel 'orders-to-archive' send messages? Give its destination URI.
  • What message TTL does the policy orders-ttl set, and which queues does it apply to?

RabbitMQ is an independent open-source connector from Query.Farm. It is not affiliated with, endorsed by or sponsored by the services, projects or organisations it works with. Product names, logos and trademarks belong to their respective owners.