pub struct Client<E, U, P> { /* private fields */ }Expand description
A client for the RabbitMQ HTTP API.
Most functions provided by this type represent various HTTP API operations. For example,
- the
Client::get_queue_infofunction corresponds to theGET /api/queues/{vhost}/{name}endpoint - the
Client::list_user_connectionsfunction corresponds to theGET /api/connections/username/{username}endpoint
and so on.
Example
use rabbitmq_http_client::blocking_api::Client;
let endpoint = "http://localhost:15672/api";
let username = "username";
let password = "password";
let rc = Client::new(&endpoint, &username, &password);
// list cluster nodes
rc.list_nodes();
// list user connections
rc.list_connections();
// fetch information and metrics of a specific queue
rc.get_queue_info("/", "qq.1");Implementations§
Source§impl<E, U, P> Client<E, U, P>
impl<E, U, P> Client<E, U, P>
Sourcepub fn oauth_configuration(&self) -> Result<OAuthConfiguration>
pub fn oauth_configuration(&self) -> Result<OAuthConfiguration>
Returns the current OAuth 2.0 configuration for authentication. See OAuth 2 Guide to learn more.
No authentication required. Does not modify state.
Can be used by restricted monitoring users with the monitoring tag and only the read, configure permissions.
Sourcepub fn auth_attempts_statistics(
&self,
node: &str,
) -> Result<Vec<AuthenticationAttemptStatistics>>
pub fn auth_attempts_statistics( &self, node: &str, ) -> Result<Vec<AuthenticationAttemptStatistics>>
Returns authentication attempt statistics for a given node.
Requires the monitoring user tag. Does not modify state.
Can be used by restricted monitoring users with the monitoring tag and only the read, configure permissions.
Source§impl<E, U, P> Client<E, U, P>
impl<E, U, P> Client<E, U, P>
Sourcepub fn list_bindings(&self) -> Result<Vec<BindingInfo>>
pub fn list_bindings(&self) -> Result<Vec<BindingInfo>>
Lists all bindings (both queue-to-exchange and exchange-to-exchange ones) across the cluster.
Requires the management user tag and the read permissions. Does not modify state.
Sourcepub fn list_bindings_in(&self, virtual_host: &str) -> Result<Vec<BindingInfo>>
pub fn list_bindings_in(&self, virtual_host: &str) -> Result<Vec<BindingInfo>>
Lists all bindings (both queue-to-exchange and exchange-to-exchange ones) in the given virtual host.
Requires the management user tag and the read permissions. Does not modify state.
Sourcepub fn list_queue_bindings(
&self,
virtual_host: &str,
queue: &str,
) -> Result<Vec<BindingInfo>>
pub fn list_queue_bindings( &self, virtual_host: &str, queue: &str, ) -> Result<Vec<BindingInfo>>
Lists all bindings of a specific queue. Use this function for troubleshooting routing of a particular queue.
Requires the management user tag and have read permissions on the queue. Does not modify state.
Sourcepub fn list_exchange_bindings_with_source(
&self,
virtual_host: &str,
exchange: &str,
) -> Result<Vec<BindingInfo>>
pub fn list_exchange_bindings_with_source( &self, virtual_host: &str, exchange: &str, ) -> Result<Vec<BindingInfo>>
Lists all bindings of a specific exchange where it is the source. Use this function for troubleshooting routing of a particular exchange.
Requires the management user tag and have read permissions on the exchange. Does not modify state.
Sourcepub fn list_exchange_bindings_with_destination(
&self,
virtual_host: &str,
exchange: &str,
) -> Result<Vec<BindingInfo>>
pub fn list_exchange_bindings_with_destination( &self, virtual_host: &str, exchange: &str, ) -> Result<Vec<BindingInfo>>
Lists all bindings of a specific exchange where it is the destination. Use this function for troubleshooting routing of a particular exchange.
Requires the management user tag and have read permissions on the exchange. Does not modify state.
Sourcepub fn bind_queue(
&self,
vhost: &str,
queue: &str,
exchange: &str,
routing_key: Option<&str>,
arguments: XArguments,
) -> Result<()>
pub fn bind_queue( &self, vhost: &str, queue: &str, exchange: &str, routing_key: Option<&str>, arguments: XArguments, ) -> Result<()>
Binds a queue or a stream to an exchange.
Bindings determine how messages published to an exchange are routed to queues. The exchange type, routing key and arguments define the routing behavior.
Both the source (exchange) and destination (queue or stream) must exist.
Requires the management user tag and have write permissions on the queue and read permissions on the exchange.
Sourcepub fn bind_exchange(
&self,
vhost: &str,
destination: &str,
source: &str,
routing_key: Option<&str>,
arguments: XArguments,
) -> Result<()>
pub fn bind_exchange( &self, vhost: &str, destination: &str, source: &str, routing_key: Option<&str>, arguments: XArguments, ) -> Result<()>
Bindings one exchange to another (creates an exchange-to-exchange binding).
This allows messages published to the source exchange to be forwarded to
Exchange-to-exchange bindings enable complex routing topologies and message flow patterns.
Both source and destination exchanges must exist.
Requires the management user tag and have write permissions on the destination exchange and read permissions on the source exchange.
Sourcepub fn recreate_binding(&self, binding: &BindingInfo) -> Result<()>
pub fn recreate_binding(&self, binding: &BindingInfo) -> Result<()>
Re-creates a binding from a BindingInfo response.
This is useful when you have retrieved a binding from the API and want to replicate it (e.g., after deleting or in a different virtual host).
Requires the management user tag and have write permissions on the destination and read permissions on the source.
pub fn delete_binding( &self, params: &BindingDeletionParams<'_>, idempotently: bool, ) -> Result<()>
Source§impl<E, U, P> Client<E, U, P>
impl<E, U, P> Client<E, U, P>
Sourcepub fn list_channels(&self) -> Result<Vec<Channel>>
pub fn list_channels(&self) -> Result<Vec<Channel>>
Lists all channels across the cluster. See Channels Guide to learn more.
Requires the management user tag. Does not modify state.
Sourcepub fn list_channels_paged(
&self,
params: &PaginationParams,
) -> Result<Vec<Channel>>
pub fn list_channels_paged( &self, params: &PaginationParams, ) -> Result<Vec<Channel>>
Lists channels with pagination.
Requires the management user tag. Does not modify state.
Sourcepub fn list_channels_in(&self, virtual_host: &str) -> Result<Vec<Channel>>
pub fn list_channels_in(&self, virtual_host: &str) -> Result<Vec<Channel>>
Lists all channels in the given virtual host. See Channels Guide to learn more.
Requires the management user tag. Does not modify state.
Sourcepub fn list_channels_in_paged(
&self,
virtual_host: &str,
params: &PaginationParams,
) -> Result<Vec<Channel>>
pub fn list_channels_in_paged( &self, virtual_host: &str, params: &PaginationParams, ) -> Result<Vec<Channel>>
Lists channels in the given virtual host with pagination.
Requires the management user tag. Does not modify state.
Sourcepub fn list_channels_on(&self, connection_name: &str) -> Result<Vec<Channel>>
pub fn list_channels_on(&self, connection_name: &str) -> Result<Vec<Channel>>
Lists all channels on a given AMQP 0-9-1 connection. See Channels Guide to learn more.
Requires the management user tag. Does not modify state.
Sourcepub fn get_channel_info<S: AsRef<str>>(
&self,
channel_name: S,
) -> Result<Channel>
pub fn get_channel_info<S: AsRef<str>>( &self, channel_name: S, ) -> Result<Channel>
Returns information about a specific channel.
Unlike AMQP 0-9-1, HTTP API identifies channels by a string identifier instead of a numeric ID.
Channel name is usually obtained from crate::responses::Channel,
e.g. via Client#list_channels, Client#list_channels_in, Client#list_channels_on.
See Channels Guide to learn more.
Requires the management user tag. Does not modify state.
Source§impl<E, U, P> Client<E, U, P>
impl<E, U, P> Client<E, U, P>
Sourcepub fn new(endpoint: E, username: U, password: P) -> Self
pub fn new(endpoint: E, username: U, password: P) -> Self
Instantiates a client for the specified endpoint with username and password.
Unlike its counterpart from crate::api, this client will perform HTTP API requests synchronously.
Example
use rabbitmq_http_client::blocking_api::Client;
let endpoint = "http://localhost:15672/api";
let username = "username";
let password = "password";
let rc = Client::new(endpoint, username, password);Sourcepub fn from_http_client(
client: HttpClient,
endpoint: E,
username: U,
password: P,
) -> Self
pub fn from_http_client( client: HttpClient, endpoint: E, username: U, password: P, ) -> Self
Instantiates a client for the specified endpoint with username and password and pre-build HttpClient. Credentials default to guest/guest.
Example
use reqwest::blocking::Client as HttpClient;
use rabbitmq_http_client::blocking_api::Client;
let client = HttpClient::new();
let endpoint = "http://localhost:15672/api";
let username = "username";
let password = "password";
let rc = Client::from_http_client(client, endpoint, username, password);Sourcepub fn from_http_client_with_retry(
client: HttpClient,
endpoint: E,
username: U,
password: P,
retry_settings: RetrySettings,
) -> Self
pub fn from_http_client_with_retry( client: HttpClient, endpoint: E, username: U, password: P, retry_settings: RetrySettings, ) -> Self
Instantiates a client for the specified endpoint with user credentials, a pre-built HttpClient, and retry settings.
Source§impl<E, U, P> Client<E, U, P>
impl<E, U, P> Client<E, U, P>
Sourcepub fn get_cluster_name(&self) -> Result<ClusterIdentity>
pub fn get_cluster_name(&self) -> Result<ClusterIdentity>
Gets cluster name (identifier).
Requires the management user tag. Does not modify state.
Sourcepub fn set_cluster_name(&self, new_name: &str) -> Result<()>
pub fn set_cluster_name(&self, new_name: &str) -> Result<()>
Sets cluster name (identifier).
Requires the administrator user tag.
Gets cluster tags.
Requires the policymaker user tag. Does not modify state.
Sets cluster tags.
Requires the administrator user tag.
Clears all cluster tags.
Requires the administrator user tag.
Source§impl<E, U, P> Client<E, U, P>
impl<E, U, P> Client<E, U, P>
Sourcepub fn list_connections(&self) -> Result<Vec<Connection>>
pub fn list_connections(&self) -> Result<Vec<Connection>>
Lists all AMQP 1.0 and 0-9-1 client connections across the cluster. See Connections Guide to learn more.
Requires the management user tag. Does not modify state.
Sourcepub fn list_connections_paged(
&self,
params: &PaginationParams,
) -> Result<Vec<Connection>>
pub fn list_connections_paged( &self, params: &PaginationParams, ) -> Result<Vec<Connection>>
Lists connections with pagination.
Requires the management user tag. Does not modify state.
Sourcepub fn get_connection_info(&self, name: &str) -> Result<Connection>
pub fn get_connection_info(&self, name: &str) -> Result<Connection>
Returns information about a connection.
Connection name is usually obtained from crate::responses::Connection or crate::responses::UserConnection,
e.g. via Client#list_connections, Client#list_connections_in, Client#list_user_connections.
Requires the management user tag. Does not modify state.
Sourcepub fn get_stream_connection_info(
&self,
virtual_host: &str,
name: &str,
) -> Result<Connection>
pub fn get_stream_connection_info( &self, virtual_host: &str, name: &str, ) -> Result<Connection>
Returns information about a stream connection.
Connection name is usually obtained from crate::responses::Connection or crate::responses::UserConnection,
e.g. via Client#list_stream_connections, Client#list_stream_connections_in, Client#list_user_connections.
Requires the management user tag. Does not modify state.
Sourcepub fn close_connection(
&self,
name: &str,
reason: Option<&str>,
idempotently: bool,
) -> Result<()>
pub fn close_connection( &self, name: &str, reason: Option<&str>, idempotently: bool, ) -> Result<()>
Closes a connection with an optional reason.
The reason will be passed on in the connection error to the client and will be logged on the RabbitMQ end.
Requires the management user tag.
Sourcepub fn close_user_connections(
&self,
username: &str,
reason: Option<&str>,
idempotently: bool,
) -> Result<()>
pub fn close_user_connections( &self, username: &str, reason: Option<&str>, idempotently: bool, ) -> Result<()>
Closes all connections for a user with an optional reason.
The reason will be passed on in the connection error to the client and will be logged on the RabbitMQ end.
This is en equivalent of listing all connections of a user with Client#list_user_connections and then
closing them one by one.
Requires the administrator user tag.
Sourcepub fn list_connections_in(&self, virtual_host: &str) -> Result<Vec<Connection>>
pub fn list_connections_in(&self, virtual_host: &str) -> Result<Vec<Connection>>
Lists all connections in the given virtual host. See Connections Guide to learn more.
Requires the management user tag. Does not modify state.
Sourcepub fn list_user_connections(
&self,
username: &str,
) -> Result<Vec<UserConnection>>
pub fn list_user_connections( &self, username: &str, ) -> Result<Vec<UserConnection>>
Lists all connections of a specific user. See Connection Guide to learn more.
Requires the management user tag. Does not modify state.
Sourcepub fn list_stream_connections(&self) -> Result<Vec<Connection>>
pub fn list_stream_connections(&self) -> Result<Vec<Connection>>
Lists all RabbitMQ Stream Protocol client connections across the cluster. See RabbitMQ Streams Guide to learn more.
Requires the management user tag. Does not modify state.
Sourcepub fn list_stream_connections_in(
&self,
virtual_host: &str,
) -> Result<Vec<Connection>>
pub fn list_stream_connections_in( &self, virtual_host: &str, ) -> Result<Vec<Connection>>
Lists RabbitMQ Stream Protocol client connections in the given virtual host. See RabbitMQ Streams Guide to learn more.
Requires the management user tag. Does not modify state.
Source§impl<E, U, P> Client<E, U, P>
impl<E, U, P> Client<E, U, P>
Sourcepub fn list_stream_publishers(&self) -> Result<Vec<StreamPublisher>>
pub fn list_stream_publishers(&self) -> Result<Vec<StreamPublisher>>
Lists all stream publishers across the cluster.
Requires the management user tag. Does not modify state.
Sourcepub fn list_stream_publishers_in(
&self,
virtual_host: &str,
) -> Result<Vec<StreamPublisher>>
pub fn list_stream_publishers_in( &self, virtual_host: &str, ) -> Result<Vec<StreamPublisher>>
Lists stream publishers publishing to the given stream.
Requires the management user tag. Does not modify state.
Sourcepub fn list_stream_publishers_of(
&self,
virtual_host: &str,
name: &str,
) -> Result<Vec<StreamPublisher>>
pub fn list_stream_publishers_of( &self, virtual_host: &str, name: &str, ) -> Result<Vec<StreamPublisher>>
Lists stream publishers publishing to the given stream. Useful for detecting publishers that are publishing to a specific stream.
Requires the management user tag. Does not modify state.
Sourcepub fn list_stream_publishers_on_connection(
&self,
virtual_host: &str,
name: &str,
) -> Result<Vec<StreamPublisher>>
pub fn list_stream_publishers_on_connection( &self, virtual_host: &str, name: &str, ) -> Result<Vec<StreamPublisher>>
Lists stream publishers on the given stream connection. Use this function for inspecting stream publishers on a specific connection.
Requires the management user tag. Does not modify state.
Sourcepub fn list_stream_consumers(&self) -> Result<Vec<StreamConsumer>>
pub fn list_stream_consumers(&self) -> Result<Vec<StreamConsumer>>
Lists all stream consumers across the cluster.
Requires the management user tag. Does not modify state.
Sourcepub fn list_stream_consumers_in(
&self,
virtual_host: &str,
) -> Result<Vec<StreamConsumer>>
pub fn list_stream_consumers_in( &self, virtual_host: &str, ) -> Result<Vec<StreamConsumer>>
Lists stream consumers on connections in the given virtual host.
Requires the management user tag. Does not modify state.
Sourcepub fn list_stream_consumers_on_connection(
&self,
virtual_host: &str,
name: &str,
) -> Result<Vec<StreamConsumer>>
pub fn list_stream_consumers_on_connection( &self, virtual_host: &str, name: &str, ) -> Result<Vec<StreamConsumer>>
Lists stream consumers on the given stream connection. Use this function for inspecting stream consumers on a specific connection.
Requires the management user tag. Does not modify state.
Sourcepub fn list_consumers(&self) -> Result<Vec<Consumer>>
pub fn list_consumers(&self) -> Result<Vec<Consumer>>
Lists all consumers across the cluster. See Consumers Guide to learn more.
Requires the management user tag. Does not modify state.
Sourcepub fn list_consumers_in(&self, virtual_host: &str) -> Result<Vec<Consumer>>
pub fn list_consumers_in(&self, virtual_host: &str) -> Result<Vec<Consumer>>
Lists all consumers in the given virtual host. See Consumers Guide to learn more.
Requires the management user tag. Does not modify state.
Source§impl<E, U, P> Client<E, U, P>
impl<E, U, P> Client<E, U, P>
Sourcepub fn export_cluster_wide_definitions(&self) -> Result<String>
pub fn export_cluster_wide_definitions(&self) -> Result<String>
Exports cluster-wide definitions as a JSON document. This includes all virtual hosts, users, permissions, policies, queues, streams, exchanges, bindings, runtime parameters.
See Definition Export and Import to learn more.
Requires the administrator user tag. Does not modify state.
Sourcepub fn export_cluster_wide_definitions_as_string(&self) -> Result<String>
pub fn export_cluster_wide_definitions_as_string(&self) -> Result<String>
Exports cluster-wide definitions as a JSON document. This includes all virtual hosts, users, permissions, policies, queues, streams, exchanges, bindings, runtime parameters.
See Definition Export and Import to learn more.
Requires the administrator user tag. Does not modify state.
Sourcepub fn export_cluster_wide_definitions_as_data(
&self,
) -> Result<ClusterDefinitionSet>
pub fn export_cluster_wide_definitions_as_data( &self, ) -> Result<ClusterDefinitionSet>
Exports cluster-wide definitions as a data structure. This includes all virtual hosts, users, permissions, policies, queues, streams, exchanges, bindings, runtime parameters.
See Definition Export and Import to learn more.
Requires the administrator user tag. Does not modify state.
Sourcepub fn export_vhost_definitions(&self, vhost: &str) -> Result<String>
pub fn export_vhost_definitions(&self, vhost: &str) -> Result<String>
Exports definitions of a single virtual host as a JSON document. This includes the permissions, policies, queues, streams, exchanges, bindings, runtime parameters associated with the given virtual host.
See Definition Export and Import to learn more.
Requires the administrator user tag. Does not modify state.
Sourcepub fn export_vhost_definitions_as_string(&self, vhost: &str) -> Result<String>
pub fn export_vhost_definitions_as_string(&self, vhost: &str) -> Result<String>
Exports definitions of a single virtual host as a JSON document. This includes the permissions, policies, queues, streams, exchanges, bindings, runtime parameters associated with the given virtual host.
See Definition Export and Import to learn more.
Requires the administrator user tag. Does not modify state.
Sourcepub fn export_vhost_definitions_as_data(
&self,
vhost: &str,
) -> Result<VirtualHostDefinitionSet>
pub fn export_vhost_definitions_as_data( &self, vhost: &str, ) -> Result<VirtualHostDefinitionSet>
Exports definitions of a single virtual host as a data structure. This includes the permissions, policies, queues, streams, exchanges, bindings, runtime parameters associated with the given virtual host.
See Definition Export and Import to learn more.
Requires the administrator user tag. Does not modify state.
Sourcepub fn import_definitions(&self, definitions: Value) -> Result<()>
pub fn import_definitions(&self, definitions: Value) -> Result<()>
Imports cluster-wide definitions from a JSON document value.
See Definition Export and Import to learn more.
Requires the administrator user tag.
Sourcepub fn import_cluster_wide_definitions(&self, definitions: Value) -> Result<()>
pub fn import_cluster_wide_definitions(&self, definitions: Value) -> Result<()>
Imports cluster-wide definitions from a JSON document value.
See Definition Export and Import to learn more.
Requires the administrator user tag.
Sourcepub fn import_vhost_definitions(
&self,
vhost: &str,
definitions: Value,
) -> Result<()>
pub fn import_vhost_definitions( &self, vhost: &str, definitions: Value, ) -> Result<()>
Imports definitions of a single virtual host from a JSON document value.
See Definition Export and Import to learn more.
Requires the administrator user tag.
Source§impl<E, U, P> Client<E, U, P>
impl<E, U, P> Client<E, U, P>
Sourcepub fn list_all_deprecated_features(&self) -> Result<DeprecatedFeatureList>
pub fn list_all_deprecated_features(&self) -> Result<DeprecatedFeatureList>
Lists all deprecated features. See Deprecated Features to learn more.
Requires RabbitMQ 3.13.0 or a later version.
Requires the monitoring user tag. Does not modify state.
Can be used by restricted monitoring users with the monitoring tag and only the read, configure permissions.
Sourcepub fn list_deprecated_features_in_use(&self) -> Result<DeprecatedFeatureList>
pub fn list_deprecated_features_in_use(&self) -> Result<DeprecatedFeatureList>
Lists deprecated features that are in use. See Deprecated Features to learn more.
Requires RabbitMQ 3.13.0 or a later version.
Requires the monitoring user tag. Does not modify state.
Can be used by restricted monitoring users with the monitoring tag and only the read, configure permissions.
Source§impl<E, U, P> Client<E, U, P>
impl<E, U, P> Client<E, U, P>
Sourcepub fn list_exchanges(&self) -> Result<Vec<ExchangeInfo>>
pub fn list_exchanges(&self) -> Result<Vec<ExchangeInfo>>
Lists all exchanges across the cluster. See Exchanges Guide to learn more.
Requires the management user tag and have read permissions on the exchanges. Does not modify state.
Sourcepub fn list_exchanges_paged(
&self,
params: &PaginationParams,
) -> Result<Vec<ExchangeInfo>>
pub fn list_exchanges_paged( &self, params: &PaginationParams, ) -> Result<Vec<ExchangeInfo>>
Lists exchanges with pagination.
Requires the management user tag and have read permissions on the exchanges. Does not modify state.
Sourcepub fn list_exchanges_in(&self, virtual_host: &str) -> Result<Vec<ExchangeInfo>>
pub fn list_exchanges_in(&self, virtual_host: &str) -> Result<Vec<ExchangeInfo>>
Lists all exchanges in the given virtual host. See Exchanges Guide to learn more.
Requires the management user tag and have read permissions on the exchanges. Does not modify state.
Sourcepub fn list_exchanges_in_paged(
&self,
virtual_host: &str,
params: &PaginationParams,
) -> Result<Vec<ExchangeInfo>>
pub fn list_exchanges_in_paged( &self, virtual_host: &str, params: &PaginationParams, ) -> Result<Vec<ExchangeInfo>>
Lists exchanges in the given virtual host with pagination.
Requires the management user tag and have read permissions on the exchanges. Does not modify state.
Sourcepub fn get_exchange_info(
&self,
virtual_host: &str,
name: &str,
) -> Result<ExchangeInfo>
pub fn get_exchange_info( &self, virtual_host: &str, name: &str, ) -> Result<ExchangeInfo>
Returns information about an exchange. See Exchanges Guide to learn more.
Requires the management user tag and have read permissions on the exchange. Does not modify state.
Sourcepub fn declare_exchange(
&self,
vhost: &str,
params: &ExchangeParams<'_>,
) -> Result<()>
pub fn declare_exchange( &self, vhost: &str, params: &ExchangeParams<'_>, ) -> Result<()>
Declares an exchange.
If the exchange already exists with different parameters, this operation may fail unless the parameters are equivalent.
Requires the management user tag and have configure permissions on the exchange.
Sourcepub fn delete_exchange(
&self,
vhost: &str,
name: &str,
idempotently: bool,
) -> Result<()>
pub fn delete_exchange( &self, vhost: &str, name: &str, idempotently: bool, ) -> Result<()>
Deletes an exchange in a specified virtual host.
Unless idempotently is set to true, an attempt to delete a non-existent exchange
will fail.
Requires the management user tag and have configure permissions on the exchange.
Sourcepub fn delete_exchanges(
&self,
vhost: &str,
names: &[&str],
idempotently: bool,
) -> Result<()>
pub fn delete_exchanges( &self, vhost: &str, names: &[&str], idempotently: bool, ) -> Result<()>
Deletes multiple exchanges in a specified virtual host.
When idempotently is true, non-existent exchanges are silently skipped.
When idempotently is false, the operation fails on the first non-existent exchange.
Requires the management user tag and have configure permissions on the exchanges.
Source§impl<E, U, P> Client<E, U, P>
impl<E, U, P> Client<E, U, P>
Sourcepub fn list_feature_flags(&self) -> Result<FeatureFlagList>
pub fn list_feature_flags(&self) -> Result<FeatureFlagList>
Lists all feature flags and their current states. See Feature Flags Guide to learn more.
Requires the administrator user tag. Does not modify state.
Sourcepub fn enable_feature_flag(&self, name: &str) -> Result<()>
pub fn enable_feature_flag(&self, name: &str) -> Result<()>
Enables a specific feature flag by name. This function is idempotent: enabling an already enabled feature flag will succeed. See Feature Flags Guide to learn more.
Requires the administrator user tag.
Sourcepub fn enable_all_stable_feature_flags(&self) -> Result<()>
pub fn enable_all_stable_feature_flags(&self) -> Result<()>
Enables all stable feature flags in the cluster. This function is idempotent: enabling an already enabled feature flag will succeed. See Feature Flags Guide to learn more.
Requires the administrator user tag.
Source§impl<E, U, P> Client<E, U, P>
impl<E, U, P> Client<E, U, P>
Sourcepub fn list_federation_upstreams(&self) -> Result<Vec<FederationUpstream>>
pub fn list_federation_upstreams(&self) -> Result<Vec<FederationUpstream>>
Lists federation upstreams defined in the cluster.
Requires the policymaker user tag. Does not modify state.
Sourcepub fn list_federation_links(&self) -> Result<Vec<FederationLink>>
pub fn list_federation_links(&self) -> Result<Vec<FederationLink>>
Lists federation links (connections) running in the cluster.
Requires the monitoring user tag. Does not modify state.
Can be used by restricted monitoring users with the monitoring tag and only the read, configure permissions.
Sourcepub fn declare_federation_upstream(
&self,
params: FederationUpstreamParams<'_>,
) -> Result<()>
pub fn declare_federation_upstream( &self, params: FederationUpstreamParams<'_>, ) -> Result<()>
Creates or updates a federation upstream.
Federation upstreams define connection endpoints for federation links (connections that federate queues or exchanges).
Requires the policymaker user tag.
Sourcepub fn get_federation_upstream(
&self,
vhost: &str,
name: &str,
) -> Result<FederationUpstream>
pub fn get_federation_upstream( &self, vhost: &str, name: &str, ) -> Result<FederationUpstream>
Gets a specific federation upstream by name and virtual host.
Requires the policymaker user tag. Does not modify state.
Sourcepub fn delete_federation_upstream(
&self,
vhost: &str,
name: &str,
idempotently: bool,
) -> Result<()>
pub fn delete_federation_upstream( &self, vhost: &str, name: &str, idempotently: bool, ) -> Result<()>
Deletes a federation upstream. Deleting an upstream will stop any links connected to it.
Requires the policymaker user tag.
Source§impl<E, U, P> Client<E, U, P>
impl<E, U, P> Client<E, U, P>
Sourcepub fn health_check_cluster_wide_alarms(&self) -> Result<()>
pub fn health_check_cluster_wide_alarms(&self) -> Result<()>
Performs a cluster-wide health check for any active resource alarms in the cluster. See Monitoring and Health Checks Guide to learn more.
No authentication required. Does not modify state.
Can be used by restricted monitoring users with the monitoring tag and only the read, configure permissions.
Sourcepub fn health_check_local_alarms(&self) -> Result<()>
pub fn health_check_local_alarms(&self) -> Result<()>
Performs a health check for alarms on the target node only. See Monitoring and Health Checks Guide to learn more.
No authentication required. Does not modify state.
Can be used by restricted monitoring users with the monitoring tag and only the read, configure permissions.
Sourcepub fn health_check_if_node_is_quorum_critical(&self) -> Result<()>
pub fn health_check_if_node_is_quorum_critical(&self) -> Result<()>
Will fail if target node is critical to the quorum of some quorum queues, streams or the Khepri metadata store. See Upgrades Guide to learn more.
No authentication required. Does not modify state.
Can be used by restricted monitoring users with the monitoring tag and only the read, configure permissions.
Sourcepub fn health_check_port_listener(&self, port: u16) -> Result<()>
pub fn health_check_port_listener(&self, port: u16) -> Result<()>
Checks if a specific port has an active listener. See Monitoring and Health Checks Guide and Networking Guide to learn more.
No authentication required. Does not modify state.
Can be used by restricted monitoring users with the monitoring tag and only the read, configure permissions.
Sourcepub fn health_check_protocol_listener(
&self,
protocol: SupportedProtocol,
) -> Result<()>
pub fn health_check_protocol_listener( &self, protocol: SupportedProtocol, ) -> Result<()>
Checks if a specific protocol listener is active. See Monitoring and Health Checks Guide and Networking Guide to learn more.
No authentication required. Does not modify state.
Can be used by restricted monitoring users with the monitoring tag and only the read, configure permissions.
Source§impl<E, U, P> Client<E, U, P>
impl<E, U, P> Client<E, U, P>
Sourcepub fn set_user_limit(
&self,
username: &str,
limit: EnforcedLimitParams<UserLimitTarget>,
) -> Result<()>
pub fn set_user_limit( &self, username: &str, limit: EnforcedLimitParams<UserLimitTarget>, ) -> Result<()>
Requires the administrator user tag.
Sourcepub fn clear_user_limit(
&self,
username: &str,
kind: UserLimitTarget,
) -> Result<()>
pub fn clear_user_limit( &self, username: &str, kind: UserLimitTarget, ) -> Result<()>
Requires the administrator user tag.
Sourcepub fn list_all_user_limits(&self) -> Result<Vec<UserLimits>>
pub fn list_all_user_limits(&self) -> Result<Vec<UserLimits>>
Requires the administrator user tag. Does not modify state.
Sourcepub fn list_user_limits(&self, username: &str) -> Result<Vec<UserLimits>>
pub fn list_user_limits(&self, username: &str) -> Result<Vec<UserLimits>>
Requires the administrator user tag. Does not modify state.
Sourcepub fn set_vhost_limit(
&self,
vhost: &str,
limit: EnforcedLimitParams<VirtualHostLimitTarget>,
) -> Result<()>
pub fn set_vhost_limit( &self, vhost: &str, limit: EnforcedLimitParams<VirtualHostLimitTarget>, ) -> Result<()>
Sets a virtual host limit.
Requires the administrator user tag.
Sourcepub fn clear_vhost_limit(
&self,
vhost: &str,
kind: VirtualHostLimitTarget,
) -> Result<()>
pub fn clear_vhost_limit( &self, vhost: &str, kind: VirtualHostLimitTarget, ) -> Result<()>
Clears (removes) a virtual host limit.
Requires the administrator user tag.
Sourcepub fn list_all_vhost_limits(&self) -> Result<Vec<VirtualHostLimits>>
pub fn list_all_vhost_limits(&self) -> Result<Vec<VirtualHostLimits>>
Lists all virtual host limits set in the cluster.
Requires the administrator user tag. Does not modify state.
Sourcepub fn list_vhost_limits(&self, vhost: &str) -> Result<Vec<VirtualHostLimits>>
pub fn list_vhost_limits(&self, vhost: &str) -> Result<Vec<VirtualHostLimits>>
Lists the limits of a given virtual host.
Requires the administrator user tag. Does not modify state.
Source§impl<E, U, P> Client<E, U, P>
impl<E, U, P> Client<E, U, P>
Sourcepub fn publish_message(
&self,
vhost: &str,
exchange: &str,
routing_key: &str,
payload: &str,
properties: MessageProperties,
) -> Result<MessageRouted>
pub fn publish_message( &self, vhost: &str, exchange: &str, routing_key: &str, payload: &str, properties: MessageProperties, ) -> Result<MessageRouted>
Only use this function in tests and experiments. Always use a messaging or streaming protocol client for publishing in production.
Requires the management user tag and have write permissions on the exchange.
Sourcepub fn get_messages(
&self,
vhost: &str,
queue: &str,
count: u32,
ack_mode: &str,
) -> Result<Vec<GetMessage>>
pub fn get_messages( &self, vhost: &str, queue: &str, count: u32, ack_mode: &str, ) -> Result<Vec<GetMessage>>
Only use this function in tests and experiments. Always use a messaging or streaming protocol client for consuming in production.
Requires the management user tag and have read permissions on the queue.
Source§impl<E, U, P> Client<E, U, P>
impl<E, U, P> Client<E, U, P>
Sourcepub fn list_nodes(&self) -> Result<Vec<ClusterNode>>
pub fn list_nodes(&self) -> Result<Vec<ClusterNode>>
Lists cluster nodes. See RabbitMQ Clustering Guide to learn more.
Requires the monitoring user tag. Does not modify state.
Can be used by restricted monitoring users with the monitoring tag and only the read, configure permissions.
Sourcepub fn get_node_info(&self, name: &str) -> Result<ClusterNode>
pub fn get_node_info(&self, name: &str) -> Result<ClusterNode>
Returns information about a cluster node. See Clustering Guide to learn more.
Requires the monitoring user tag. Does not modify state.
Can be used by restricted monitoring users with the monitoring tag and only the read, configure permissions.
Sourcepub fn get_node_memory_footprint(
&self,
name: &str,
) -> Result<NodeMemoryFootprint>
pub fn get_node_memory_footprint( &self, name: &str, ) -> Result<NodeMemoryFootprint>
Returns memory usage information for a cluster node. See Reasoning About Memory Footprint to learn more.
Requires the monitoring user tag. Does not modify state.
Can be used by restricted monitoring users with the monitoring tag and only the read, configure permissions.
Sourcepub fn list_all_cluster_plugins(&self) -> Result<PluginList>
pub fn list_all_cluster_plugins(&self) -> Result<PluginList>
Returns a unique set of plugins enabled on all cluster nodes. See RabbitMQ Plugins Guide to learn more.
Requires the monitoring user tag. Does not modify state.
Can be used by restricted monitoring users with the monitoring tag and only the read, configure permissions.
Sourcepub fn list_node_plugins(&self, name: &str) -> Result<PluginList>
pub fn list_node_plugins(&self, name: &str) -> Result<PluginList>
Returns the list of plugins enabled on a specific cluster node.
This is a convenience method equivalent to get_node_info(name).enabled_plugins.
See RabbitMQ Plugins Guide to learn more.
Requires the monitoring user tag. Does not modify state.
Can be used by restricted monitoring users with the monitoring tag and only the read, configure permissions.
Source§impl<E, U, P> Client<E, U, P>
impl<E, U, P> Client<E, U, P>
Sourcepub fn overview(&self) -> Result<Overview>
pub fn overview(&self) -> Result<Overview>
Provides an overview of the most commonly used cluster metrics.
See crate::responses::Overview.
Requires the management user tag. Does not modify state.
Sourcepub fn server_version(&self) -> Result<String>
pub fn server_version(&self) -> Result<String>
Returns the version of RabbitMQ used by the API endpoint.
Requires the management user tag. Does not modify state.
Source§impl<E, U, P> Client<E, U, P>
impl<E, U, P> Client<E, U, P>
Sourcepub fn list_runtime_parameters(&self) -> Result<Vec<RuntimeParameter>>
pub fn list_runtime_parameters(&self) -> Result<Vec<RuntimeParameter>>
Lists all runtime parameters defined in the cluster.
Requires the policymaker user tag. Does not modify state.
Sourcepub fn list_runtime_parameters_of_component(
&self,
component: &str,
) -> Result<Vec<RuntimeParameter>>
pub fn list_runtime_parameters_of_component( &self, component: &str, ) -> Result<Vec<RuntimeParameter>>
Lists all runtime parameters with a given component type (like “federation-upstream” or “shovel”) defined in the cluster.
Requires the policymaker user tag. Does not modify state.
Sourcepub fn list_runtime_parameters_of_component_in(
&self,
component: &str,
vhost: &str,
) -> Result<Vec<RuntimeParameter>>
pub fn list_runtime_parameters_of_component_in( &self, component: &str, vhost: &str, ) -> Result<Vec<RuntimeParameter>>
Lists all runtime parameters defined in a specific virtual host.
Requires the policymaker user tag. Does not modify state.
Sourcepub fn get_runtime_parameter(
&self,
component: &str,
vhost: &str,
name: &str,
) -> Result<RuntimeParameter>
pub fn get_runtime_parameter( &self, component: &str, vhost: &str, name: &str, ) -> Result<RuntimeParameter>
Requires the policymaker user tag. Does not modify state.
Sourcepub fn upsert_runtime_parameter<'a>(
&self,
param: &'a RuntimeParameterDefinition<'a>,
) -> Result<()>
pub fn upsert_runtime_parameter<'a>( &self, param: &'a RuntimeParameterDefinition<'a>, ) -> Result<()>
Requires the policymaker user tag.
Sourcepub fn clear_runtime_parameter(
&self,
component: &str,
vhost: &str,
name: &str,
idempotently: bool,
) -> Result<()>
pub fn clear_runtime_parameter( &self, component: &str, vhost: &str, name: &str, idempotently: bool, ) -> Result<()>
Requires the policymaker user tag.
Sourcepub fn clear_all_runtime_parameters(&self) -> Result<()>
pub fn clear_all_runtime_parameters(&self) -> Result<()>
Requires the policymaker user tag.
Sourcepub fn clear_all_runtime_parameters_of_component(
&self,
component: &str,
) -> Result<()>
pub fn clear_all_runtime_parameters_of_component( &self, component: &str, ) -> Result<()>
Requires the policymaker user tag.
Sourcepub fn list_global_runtime_parameters(
&self,
) -> Result<Vec<GlobalRuntimeParameter>>
pub fn list_global_runtime_parameters( &self, ) -> Result<Vec<GlobalRuntimeParameter>>
Requires the policymaker user tag. Does not modify state.
Sourcepub fn get_global_runtime_parameter(
&self,
name: &str,
) -> Result<GlobalRuntimeParameter>
pub fn get_global_runtime_parameter( &self, name: &str, ) -> Result<GlobalRuntimeParameter>
Requires the policymaker user tag. Does not modify state.
Sourcepub fn upsert_global_runtime_parameter<'a>(
&self,
param: &'a GlobalRuntimeParameterDefinition<'a>,
) -> Result<()>
pub fn upsert_global_runtime_parameter<'a>( &self, param: &'a GlobalRuntimeParameterDefinition<'a>, ) -> Result<()>
Requires the administrator user tag.
Sourcepub fn clear_global_runtime_parameter(&self, name: &str) -> Result<()>
pub fn clear_global_runtime_parameter(&self, name: &str) -> Result<()>
Requires the administrator user tag.
Source§impl<E, U, P> Client<E, U, P>
impl<E, U, P> Client<E, U, P>
Sourcepub fn list_permissions(&self) -> Result<Vec<Permissions>>
pub fn list_permissions(&self) -> Result<Vec<Permissions>>
Lists all permissions in the cluster. See Access Control Guide to learn more.
Requires the administrator user tag. Does not modify state.
Sourcepub fn list_permissions_in(&self, vhost: &str) -> Result<Vec<Permissions>>
pub fn list_permissions_in(&self, vhost: &str) -> Result<Vec<Permissions>>
Lists permissions in a virtual host. See Access Control Guide to learn more.
Requires the administrator user tag. Does not modify state.
Sourcepub fn list_permissions_of(&self, user: &str) -> Result<Vec<Permissions>>
pub fn list_permissions_of(&self, user: &str) -> Result<Vec<Permissions>>
Lists permissions for a specific user. See Access Control Guide to learn more.
Requires the administrator user tag. Does not modify state.
Sourcepub fn get_permissions(&self, vhost: &str, user: &str) -> Result<Permissions>
pub fn get_permissions(&self, vhost: &str, user: &str) -> Result<Permissions>
Gets permissions for a user in a virtual host. See Access Control Guide to learn more.
Requires the administrator user tag. Does not modify state.
Sourcepub fn declare_permissions(&self, params: &Permissions<'_>) -> Result<()>
pub fn declare_permissions(&self, params: &Permissions<'_>) -> Result<()>
Declares permissions for a user in a virtual host. See Access Control Guide to learn more.
Requires the administrator user tag.
Sourcepub fn grant_permissions(&self, params: &Permissions<'_>) -> Result<()>
pub fn grant_permissions(&self, params: &Permissions<'_>) -> Result<()>
An easier to remember alias for [declare_permissions].
See Access Control Guide to learn more.
Requires the administrator user tag.
Sourcepub fn clear_permissions(
&self,
vhost: &str,
username: &str,
idempotently: bool,
) -> Result<()>
pub fn clear_permissions( &self, vhost: &str, username: &str, idempotently: bool, ) -> Result<()>
Revokes user permissions in a specific virtual host. See Access Control Guide to learn more.
Requires the administrator user tag.
Sourcepub fn declare_topic_permissions(
&self,
params: &TopicPermissions<'_>,
) -> Result<()>
pub fn declare_topic_permissions( &self, params: &TopicPermissions<'_>, ) -> Result<()>
Sets topic permissions in a specific virtual host. See Topic Authorisation to learn more.
Requires the administrator user tag.
Sourcepub fn list_topic_permissions(&self) -> Result<Vec<TopicPermission>>
pub fn list_topic_permissions(&self) -> Result<Vec<TopicPermission>>
Lists all topic permissions in the cluster. See Topic Authorisation to learn more.
Requires the administrator user tag. Does not modify state.
Sourcepub fn list_topic_permissions_in(
&self,
vhost: &str,
) -> Result<Vec<TopicPermission>>
pub fn list_topic_permissions_in( &self, vhost: &str, ) -> Result<Vec<TopicPermission>>
Lists all topic permissions in a virtual host. See Topic Authorisation to learn more.
Requires the administrator user tag. Does not modify state.
Sourcepub fn list_topic_permissions_of(
&self,
user: &str,
) -> Result<Vec<TopicPermission>>
pub fn list_topic_permissions_of( &self, user: &str, ) -> Result<Vec<TopicPermission>>
Lists all topic permissions of a user. See Topic Authorisation to learn more.
Requires the administrator user tag. Does not modify state.
Sourcepub fn get_topic_permissions_of(
&self,
vhost: &str,
user: &str,
) -> Result<TopicPermission>
pub fn get_topic_permissions_of( &self, vhost: &str, user: &str, ) -> Result<TopicPermission>
Gets topic permissions for a user in a specific virtual host. See Topic Authorisation to learn more.
Requires the administrator user tag. Does not modify state.
Sourcepub fn clear_topic_permissions(
&self,
vhost: &str,
user: &str,
idempotently: bool,
) -> Result<()>
pub fn clear_topic_permissions( &self, vhost: &str, user: &str, idempotently: bool, ) -> Result<()>
Clears topic permissions for a user in a specific virtual host. See Topic Authorisation to learn more.
Requires the administrator user tag.
Source§impl<E, U, P> Client<E, U, P>
impl<E, U, P> Client<E, U, P>
Sourcepub fn get_policy(&self, vhost: &str, name: &str) -> Result<Policy>
pub fn get_policy(&self, vhost: &str, name: &str) -> Result<Policy>
Fetches a policy.
Requires the policymaker user tag. Does not modify state.
Sourcepub fn list_policies(&self) -> Result<Vec<Policy>>
pub fn list_policies(&self) -> Result<Vec<Policy>>
Lists all policies in the cluster (across all virtual hosts), taking the user’s permissions into account.
Requires the policymaker user tag. Does not modify state.
Sourcepub fn list_policies_in(&self, vhost: &str) -> Result<Vec<Policy>>
pub fn list_policies_in(&self, vhost: &str) -> Result<Vec<Policy>>
Lists policies in a virtual host.
Requires the policymaker user tag. Does not modify state.
Sourcepub fn declare_policy(&self, params: &PolicyParams<'_>) -> Result<()>
pub fn declare_policy(&self, params: &PolicyParams<'_>) -> Result<()>
Declares a policy.
See crate::requests::PolicyParams and See crate::requests::PolicyDefinition
Requires the policymaker user tag.
Sourcepub fn declare_policies(&self, params: Vec<&PolicyParams<'_>>) -> Result<()>
pub fn declare_policies(&self, params: Vec<&PolicyParams<'_>>) -> Result<()>
Declares multiple policies.
Note that this function will still issue as many HTTP API requests as there are policies to declare.
See crate::requests::PolicyParams and See crate::requests::PolicyDefinition
Requires the policymaker user tag.
Sourcepub fn delete_policy(
&self,
vhost: &str,
name: &str,
idempotently: bool,
) -> Result<()>
pub fn delete_policy( &self, vhost: &str, name: &str, idempotently: bool, ) -> Result<()>
Deletes a policy. This function is idempotent: deleting a non-existent policy is considered a success.
Requires the policymaker user tag.
Sourcepub fn delete_policies_in(&self, vhost: &str, names: Vec<&str>) -> Result<()>
pub fn delete_policies_in(&self, vhost: &str, names: Vec<&str>) -> Result<()>
Deletes multiple policies.
Note that this function will still issue as many HTTP API requests as there are policies to delete.
This function is idempotent: deleting a non-existent policy is considered a success.
Requires the policymaker user tag.
Sourcepub fn get_operator_policy(&self, vhost: &str, name: &str) -> Result<Policy>
pub fn get_operator_policy(&self, vhost: &str, name: &str) -> Result<Policy>
Requires the administrator user tag. Does not modify state.
Sourcepub fn list_operator_policies(&self) -> Result<Vec<Policy>>
pub fn list_operator_policies(&self) -> Result<Vec<Policy>>
Requires the administrator user tag. Does not modify state.
Sourcepub fn list_operator_policies_in(&self, vhost: &str) -> Result<Vec<Policy>>
pub fn list_operator_policies_in(&self, vhost: &str) -> Result<Vec<Policy>>
Requires the administrator user tag. Does not modify state.
Sourcepub fn declare_operator_policy(&self, params: &PolicyParams<'_>) -> Result<()>
pub fn declare_operator_policy(&self, params: &PolicyParams<'_>) -> Result<()>
Requires the administrator user tag.
Sourcepub fn declare_operator_policies(
&self,
params: Vec<&PolicyParams<'_>>,
) -> Result<()>
pub fn declare_operator_policies( &self, params: Vec<&PolicyParams<'_>>, ) -> Result<()>
Requires the administrator user tag.
Sourcepub fn delete_operator_policy(
&self,
vhost: &str,
name: &str,
idempotently: bool,
) -> Result<()>
pub fn delete_operator_policy( &self, vhost: &str, name: &str, idempotently: bool, ) -> Result<()>
Requires the administrator user tag.
Sourcepub fn delete_operator_policies_in(
&self,
vhost: &str,
names: Vec<&str>,
) -> Result<()>
pub fn delete_operator_policies_in( &self, vhost: &str, names: Vec<&str>, ) -> Result<()>
Requires the administrator user tag.
Sourcepub fn list_policies_for_target(
&self,
vhost: &str,
target: PolicyTarget,
) -> Result<Vec<Policy>>
pub fn list_policies_for_target( &self, vhost: &str, target: PolicyTarget, ) -> Result<Vec<Policy>>
Lists policies in a virtual host that apply to the specified target.
This is a convenience method that filters policies by their apply_to field.
For example, to get only policies that apply to queues:
let queue_policies = client.list_policies_for_target("/", PolicyTarget::Queues)?;Requires the policymaker user tag. Does not modify state.
Sourcepub fn list_matching_policies(
&self,
vhost: &str,
name: &str,
target: PolicyTarget,
) -> Result<Vec<Policy>>
pub fn list_matching_policies( &self, vhost: &str, name: &str, target: PolicyTarget, ) -> Result<Vec<Policy>>
Lists policies in a virtual host that would match the given resource name and target.
This is useful for finding which policies would apply to a specific queue or exchange. Returns policies sorted by priority (highest first).
Requires the policymaker user tag. Does not modify state.
Sourcepub fn list_operator_policies_for_target(
&self,
vhost: &str,
target: PolicyTarget,
) -> Result<Vec<Policy>>
pub fn list_operator_policies_for_target( &self, vhost: &str, target: PolicyTarget, ) -> Result<Vec<Policy>>
Lists operator policies in a virtual host that apply to the specified target.
Requires the administrator user tag. Does not modify state.
Sourcepub fn list_matching_operator_policies(
&self,
vhost: &str,
name: &str,
target: PolicyTarget,
) -> Result<Vec<Policy>>
pub fn list_matching_operator_policies( &self, vhost: &str, name: &str, target: PolicyTarget, ) -> Result<Vec<Policy>>
Lists operator policies in a virtual host that would match the given resource name and target.
Returns policies sorted by priority (highest first).
Requires the administrator user tag. Does not modify state.
Source§impl<E, U, P> Client<E, U, P>
impl<E, U, P> Client<E, U, P>
Sourcepub fn list_queues(&self) -> Result<Vec<QueueInfo>>
pub fn list_queues(&self) -> Result<Vec<QueueInfo>>
Lists all queues and streams across the cluster. See Queues Guide and RabbitMQ Streams Guide to learn more.
Requires the management user tag and have read permissions on the queues. Does not modify state.
Sourcepub fn list_queues_paged(
&self,
params: &PaginationParams,
) -> Result<Vec<QueueInfo>>
pub fn list_queues_paged( &self, params: &PaginationParams, ) -> Result<Vec<QueueInfo>>
Lists queues and streams with pagination.
Requires the management user tag and have read permissions on the queues. Does not modify state.
Sourcepub fn list_queues_in(&self, virtual_host: &str) -> Result<Vec<QueueInfo>>
pub fn list_queues_in(&self, virtual_host: &str) -> Result<Vec<QueueInfo>>
Lists all queues and streams in the given virtual host. See Queues Guide and RabbitMQ Streams Guide to learn more.
Requires the management user tag and have read permissions on the queues. Does not modify state.
Sourcepub fn list_queues_in_paged(
&self,
virtual_host: &str,
params: &PaginationParams,
) -> Result<Vec<QueueInfo>>
pub fn list_queues_in_paged( &self, virtual_host: &str, params: &PaginationParams, ) -> Result<Vec<QueueInfo>>
Lists queues and streams in the given virtual host with pagination.
Requires the management user tag and have read permissions on the queues. Does not modify state.
Sourcepub fn list_queues_with_details(&self) -> Result<Vec<DetailedQueueInfo>>
pub fn list_queues_with_details(&self) -> Result<Vec<DetailedQueueInfo>>
Lists all queues and streams across the cluster. Compared to [list_queues], provides more queue metrics.
See Queues Guide and RabbitMQ Streams Guide to learn more.
Requires RabbitMQ 3.13.0 or a later version.
Requires the monitoring user tag. Does not modify state.
Can be used by restricted monitoring users with the monitoring tag and only the read, configure permissions.
Sourcepub fn get_queue_info(
&self,
virtual_host: &str,
name: &str,
) -> Result<QueueInfo>
pub fn get_queue_info( &self, virtual_host: &str, name: &str, ) -> Result<QueueInfo>
Returns information about a queue or stream. See Queues Guide to learn more.
Requires the management user tag and have read permissions on the queue. Does not modify state.
Sourcepub fn get_stream_info(
&self,
virtual_host: &str,
name: &str,
) -> Result<QueueInfo>
pub fn get_stream_info( &self, virtual_host: &str, name: &str, ) -> Result<QueueInfo>
Returns information about a stream. See RabbitMQ Streams Guide to learn more.
Requires the management user tag and have read permissions on the queue. Does not modify state.
Sourcepub fn declare_queue(&self, vhost: &str, params: &QueueParams<'_>) -> Result<()>
pub fn declare_queue(&self, vhost: &str, params: &QueueParams<'_>) -> Result<()>
Declares a queue.
If the queue already exists with different parameters, this operation may fail unless the parameters are equivalent.
Requires the management user tag and have configure permissions on the queue.
Sourcepub fn declare_stream(
&self,
vhost: &str,
params: &StreamParams<'_>,
) -> Result<()>
pub fn declare_stream( &self, vhost: &str, params: &StreamParams<'_>, ) -> Result<()>
Declares a RabbitMQ stream.
Streams are a durable, replicated, long-lived data structure in RabbitMQ designed for high-throughput scenarios. Unlike traditional queues, consuming from a stream is a non-destructive operation. Stream data is deleted according to an effective stream retention policy.
If the stream already exists with different parameters, this operation may fail unless the parameters are equivalent.
Requires the management user tag and have configure permissions on the queue.
Sourcepub fn delete_queue(
&self,
vhost: &str,
name: &str,
idempotently: bool,
) -> Result<()>
pub fn delete_queue( &self, vhost: &str, name: &str, idempotently: bool, ) -> Result<()>
Deletes a queue in a specified virtual host.
Unless idempotently is set to true, an attempt to delete a non-existent queue
will fail.
Requires the management user tag and have configure permissions on the queue.
Sourcepub fn delete_queues(
&self,
vhost: &str,
names: &[&str],
idempotently: bool,
) -> Result<()>
pub fn delete_queues( &self, vhost: &str, names: &[&str], idempotently: bool, ) -> Result<()>
Deletes multiple queues in a specified virtual host.
When idempotently is true, non-existent queues are silently skipped.
When idempotently is false, the operation fails on the first non-existent queue.
Requires the management user tag and have configure permissions on the queues.
Sourcepub fn delete_stream(
&self,
vhost: &str,
name: &str,
idempotently: bool,
) -> Result<()>
pub fn delete_stream( &self, vhost: &str, name: &str, idempotently: bool, ) -> Result<()>
Deletes a stream in a specified virtual host.
Unless idempotently is set to true, an attempt to delete a non-existent stream
will fail.
Requires the management user tag and have configure permissions on the queue.
Sourcepub fn purge_queue(&self, virtual_host: &str, name: &str) -> Result<()>
pub fn purge_queue(&self, virtual_host: &str, name: &str) -> Result<()>
Removes all messages in “ready for delivery” state from a queue without deleting the queue itself.
Messages that were delivered but are pending acknowledgement will not be deleted by purging.
Requires the management user tag and have read permissions on the queue.
Sourcepub fn declare_quorum_queue(&self, vhost: &str, name: &str) -> Result<()>
pub fn declare_quorum_queue(&self, vhost: &str, name: &str) -> Result<()>
Convenience method: declares a durable quorum queue with no arguments.
Requires the management user tag and have configure permissions on the queue.
Sourcepub fn declare_classic_queue(&self, vhost: &str, name: &str) -> Result<()>
pub fn declare_classic_queue(&self, vhost: &str, name: &str) -> Result<()>
Convenience method: declares a durable classic queue with no arguments.
Requires the management user tag and have configure permissions on the queue.
Sourcepub fn list_quorum_queues(&self) -> Result<Vec<QueueInfo>>
pub fn list_quorum_queues(&self) -> Result<Vec<QueueInfo>>
Lists only quorum queues across the cluster.
Requires the management user tag and have read permissions on the queues. Does not modify state.
Sourcepub fn list_quorum_queues_in(
&self,
virtual_host: &str,
) -> Result<Vec<QueueInfo>>
pub fn list_quorum_queues_in( &self, virtual_host: &str, ) -> Result<Vec<QueueInfo>>
Lists only quorum queues in the given virtual host.
Requires the management user tag and have read permissions on the queues. Does not modify state.
Sourcepub fn list_classic_queues(&self) -> Result<Vec<QueueInfo>>
pub fn list_classic_queues(&self) -> Result<Vec<QueueInfo>>
Lists only classic queues across the cluster.
Requires the management user tag and have read permissions on the queues. Does not modify state.
Sourcepub fn list_classic_queues_in(
&self,
virtual_host: &str,
) -> Result<Vec<QueueInfo>>
pub fn list_classic_queues_in( &self, virtual_host: &str, ) -> Result<Vec<QueueInfo>>
Lists only classic queues in the given virtual host.
Requires the management user tag and have read permissions on the queues. Does not modify state.
Sourcepub fn list_streams(&self) -> Result<Vec<QueueInfo>>
pub fn list_streams(&self) -> Result<Vec<QueueInfo>>
Lists only streams across the cluster.
Requires the management user tag and have read permissions on the queues. Does not modify state.
Sourcepub fn list_streams_in(&self, virtual_host: &str) -> Result<Vec<QueueInfo>>
pub fn list_streams_in(&self, virtual_host: &str) -> Result<Vec<QueueInfo>>
Lists only streams in the given virtual host.
Requires the management user tag and have read permissions on the queues. Does not modify state.
Sourcepub fn list_streams_paged(
&self,
params: &PaginationParams,
) -> Result<Vec<QueueInfo>>
pub fn list_streams_paged( &self, params: &PaginationParams, ) -> Result<Vec<QueueInfo>>
Lists only streams with pagination.
Note: Pagination is applied server-side to all queues, then streams are filtered client-side. This means the number of results may be less than the page size even on non-final pages.
Requires the management user tag and have read permissions on the queues. Does not modify state.
Sourcepub fn list_streams_in_paged(
&self,
virtual_host: &str,
params: &PaginationParams,
) -> Result<Vec<QueueInfo>>
pub fn list_streams_in_paged( &self, virtual_host: &str, params: &PaginationParams, ) -> Result<Vec<QueueInfo>>
Lists only streams in the given virtual host with pagination.
Note: Pagination is applied server-side to all queues, then streams are filtered client-side. This means the number of results may be less than the page size even on non-final pages.
Requires the management user tag and have read permissions on the queues. Does not modify state.
Source§impl<E, U, P> Client<E, U, P>
impl<E, U, P> Client<E, U, P>
Sourcepub fn probe_reachability(&self) -> ReachabilityProbeOutcome
pub fn probe_reachability(&self) -> ReachabilityProbeOutcome
Tests whether the node is reachable and the configured credentials are accepted.
Calls GET /api/whoami. Does not check node health, cluster identity,
or resource alarms — the caller can compose those after a Reached result.
Source§impl<E, U, P> Client<E, U, P>
impl<E, U, P> Client<E, U, P>
Sourcepub fn rebalance_queue_leaders(&self) -> Result<()>
pub fn rebalance_queue_leaders(&self) -> Result<()>
Triggers queue leader rebalancing across the cluster.
Requires the administrator user tag.
Source§impl<E, U, P> Client<E, U, P>
impl<E, U, P> Client<E, U, P>
Sourcepub fn list_shovels(&self) -> Result<Vec<Shovel>>
pub fn list_shovels(&self) -> Result<Vec<Shovel>>
Lists shovel across all virtual hosts in the cluster.
Requires the monitoring user tag. Does not modify state.
Can be used by restricted monitoring users with the monitoring tag and only the read, configure permissions.
Sourcepub fn list_shovels_in(&self, vhost: &str) -> Result<Vec<Shovel>>
pub fn list_shovels_in(&self, vhost: &str) -> Result<Vec<Shovel>>
Lists dynamic shovels in a specific virtual host.
Requires the monitoring user tag. Does not modify state.
Can be used by restricted monitoring users with the monitoring tag and only the read, configure permissions.
Sourcepub fn declare_amqp091_shovel(
&self,
params: Amqp091ShovelParams<'_>,
) -> Result<()>
pub fn declare_amqp091_shovel( &self, params: Amqp091ShovelParams<'_>, ) -> Result<()>
Declares shovel that will use the AMQP 0-9-1 protocol for both source and destination collection.
Requires the policymaker user tag.
Sourcepub fn declare_amqp10_shovel(
&self,
params: Amqp10ShovelParams<'_>,
) -> Result<()>
pub fn declare_amqp10_shovel( &self, params: Amqp10ShovelParams<'_>, ) -> Result<()>
Declares shovel that will use the AMQP 1.0 protocol for both source and destination collection.
Requires the policymaker user tag.
Source§impl<E, U, P> Client<E, U, P>
impl<E, U, P> Client<E, U, P>
Sourcepub fn schema_definition_sync_status(
&self,
node: Option<&str>,
) -> Result<SchemaDefinitionSyncStatus>
pub fn schema_definition_sync_status( &self, node: Option<&str>, ) -> Result<SchemaDefinitionSyncStatus>
Returns the status of schema definition synchronization. See Schema Definition Synchronization to learn more.
Requires VMware Tanzu RabbitMQ.
Requires the administrator user tag. Does not modify state.
Sourcepub fn enable_schema_definition_sync_on_node(
&self,
node: Option<&str>,
) -> Result<()>
pub fn enable_schema_definition_sync_on_node( &self, node: Option<&str>, ) -> Result<()>
Enables schema definition synchronization on a single node or cluster-wide. See Schema Definition Synchronization to learn more.
Requires VMware Tanzu RabbitMQ.
Requires the administrator user tag.
Sourcepub fn disable_schema_definition_sync_on_node(
&self,
node: Option<&str>,
) -> Result<()>
pub fn disable_schema_definition_sync_on_node( &self, node: Option<&str>, ) -> Result<()>
Disables schema definition synchronization on a specific node. See Schema Definition Synchronization to learn more.
Requires VMware Tanzu RabbitMQ.
Requires the administrator user tag.
Sourcepub fn enable_schema_definition_sync(&self) -> Result<()>
pub fn enable_schema_definition_sync(&self) -> Result<()>
Enables schema definition synchronization cluster-wide. See Schema Definition Synchronization to learn more.
Requires VMware Tanzu RabbitMQ.
Requires the administrator user tag.
Sourcepub fn disable_schema_definition_sync(&self) -> Result<()>
pub fn disable_schema_definition_sync(&self) -> Result<()>
Disables schema definition synchronization cluster-wide. See Schema Definition Synchronization to learn more.
Requires VMware Tanzu RabbitMQ.
Requires the administrator user tag.
Sourcepub fn warm_standby_replication_status(
&self,
) -> Result<WarmStandbyReplicationStatus>
pub fn warm_standby_replication_status( &self, ) -> Result<WarmStandbyReplicationStatus>
Returns the status of warm standby replication. See Warm Standby Replication to learn more.
Requires VMware Tanzu RabbitMQ.
Requires the administrator user tag. Does not modify state.
Source§impl<E, U, P> Client<E, U, P>
impl<E, U, P> Client<E, U, P>
Sourcepub fn list_users(&self) -> Result<Vec<User>>
pub fn list_users(&self) -> Result<Vec<User>>
Lists users in the internal database. See Access Control Guide to learn more.
Requires the administrator user tag. Does not modify state.
Sourcepub fn list_users_paged(&self, params: &PaginationParams) -> Result<Vec<User>>
pub fn list_users_paged(&self, params: &PaginationParams) -> Result<Vec<User>>
Lists users with pagination.
Requires the administrator user tag. Does not modify state.
Sourcepub fn list_users_without_permissions(&self) -> Result<Vec<User>>
pub fn list_users_without_permissions(&self) -> Result<Vec<User>>
Lists users in the internal database that do not have access to any virtual hosts. This is useful for finding users that may need permissions granted, or are not used and should be cleaned up.
Requires the administrator user tag. Does not modify state.
Sourcepub fn get_user(&self, name: &str) -> Result<User>
pub fn get_user(&self, name: &str) -> Result<User>
Returns information about a user in the internal database. See Access Control Guide to learn more.
Requires the administrator user tag. Does not modify state.
Sourcepub fn current_user(&self) -> Result<CurrentUser>
pub fn current_user(&self) -> Result<CurrentUser>
Returns information about the authenticated user. See Access Control Guide to learn more.
Requires the management user tag. Does not modify state.
Sourcepub fn create_user(&self, params: &UserParams<'_>) -> Result<()>
pub fn create_user(&self, params: &UserParams<'_>) -> Result<()>
Adds a user to the internal database.
See UserParams and crate::password_hashing.
Requires the administrator user tag.
Sourcepub fn delete_user(&self, username: &str, idempotently: bool) -> Result<()>
pub fn delete_user(&self, username: &str, idempotently: bool) -> Result<()>
Deletes a user from the internal RabbitMQ user database.
This removes the user account entirely, including all associated permissions
across all virtual hosts. Active connections belonging to this user will be
closed. If idempotently is true, the operation will succeed even if the
user doesn’t exist.
Requires the administrator user tag.
Sourcepub fn delete_users(&self, usernames: Vec<&str>) -> Result<()>
pub fn delete_users(&self, usernames: Vec<&str>) -> Result<()>
Deletes multiple users from the internal database in a single operation.
This is more efficient than calling Client::delete_user multiple times when you
need to remove several user accounts. All specified users will be deleted
along with their permissions, and any active connections will be closed.
Non-existent users in the list are silently ignored.
Requires the administrator user tag.
Source§impl<E, U, P> Client<E, U, P>
impl<E, U, P> Client<E, U, P>
Sourcepub fn list_vhosts(&self) -> Result<Vec<VirtualHost>>
pub fn list_vhosts(&self) -> Result<Vec<VirtualHost>>
Lists virtual hosts in the cluster. See Virtual Hosts Guide to learn more.
Requires the management user tag. Does not modify state.
Sourcepub fn list_vhosts_paged(
&self,
params: &PaginationParams,
) -> Result<Vec<VirtualHost>>
pub fn list_vhosts_paged( &self, params: &PaginationParams, ) -> Result<Vec<VirtualHost>>
Lists virtual hosts with pagination.
Requires the management user tag. Does not modify state.
Sourcepub fn get_vhost(&self, name: &str) -> Result<VirtualHost>
pub fn get_vhost(&self, name: &str) -> Result<VirtualHost>
Returns information about a virtual host. See Virtual Hosts Guide to learn more.
Requires the management user tag. Does not modify state.
Sourcepub fn create_vhost(&self, params: &VirtualHostParams<'_>) -> Result<()>
pub fn create_vhost(&self, params: &VirtualHostParams<'_>) -> Result<()>
Sourcepub fn update_vhost(&self, params: &VirtualHostParams<'_>) -> Result<()>
pub fn update_vhost(&self, params: &VirtualHostParams<'_>) -> Result<()>
Creates a virtual host or updates metadata of an existing one.
Requires the administrator user tag.
Sourcepub fn delete_vhost(&self, vhost: &str, idempotently: bool) -> Result<()>
pub fn delete_vhost(&self, vhost: &str, idempotently: bool) -> Result<()>
Deletes a virtual host and all its contents.
This is a destructive operation that will permanently remove the virtual host
along with all queues, exchanges, bindings, and messages it contains. All
connections to this virtual host will be closed. If idempotently is true,
the operation will succeed even if the virtual host doesn’t exist.
Requires the administrator user tag.
Sourcepub fn enable_vhost_deletion_protection(&self, vhost: &str) -> Result<()>
pub fn enable_vhost_deletion_protection(&self, vhost: &str) -> Result<()>
Enables deletion protection for a virtual host.
This prevents the virtual host from being deleted unless the protection
has been explicitly lifted (disabled) using [disable_vhost_deletion_protection].
See Virtual Host Deletion Protection to learn more.
Requires RabbitMQ 4.1.0 or a later version.
Requires the administrator user tag.
Sourcepub fn disable_vhost_deletion_protection(&self, vhost: &str) -> Result<()>
pub fn disable_vhost_deletion_protection(&self, vhost: &str) -> Result<()>
Disables deletion protection for a virtual host.
This allows the virtual host to be deleted again.
See Virtual Host Deletion Protection to learn more.
Requires RabbitMQ 4.1.0 or a later version.
Requires the administrator user tag.
Trait Implementations§
Auto Trait Implementations§
impl<E, U, P> Freeze for Client<E, U, P>
impl<E, U, P> !RefUnwindSafe for Client<E, U, P>
impl<E, U, P> Send for Client<E, U, P>
impl<E, U, P> Sync for Client<E, U, P>
impl<E, U, P> Unpin for Client<E, U, P>
impl<E, U, P> UnsafeUnpin for Client<E, U, P>
impl<E, U, P> !UnwindSafe for Client<E, U, P>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more