Skip to content

Commit

Permalink
Add Client#list_stream_connections
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelklishin committed Dec 31, 2024
1 parent 9a2ec42 commit 114331c
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 2 deletions.
9 changes: 8 additions & 1 deletion src/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ where
Ok(response)
}

/// Lists all client connections across the cluster.
/// Lists all AMQP 1.0 and 0-9-1 client connections across the cluster.
pub async fn list_connections(&self) -> Result<Vec<responses::Connection>> {
let response = self.http_get("connections", None, None).await?;
let response = response.json().await?;
Expand Down Expand Up @@ -314,6 +314,13 @@ where
Ok(response)
}

/// Lists all RabbitMQ Stream Protocol client connections across the cluster.
pub async fn list_stream_connections(&self) -> Result<Vec<responses::Connection>> {
let response = self.http_get("stream/connections", None, None).await?;
let response = response.json().await?;
Ok(response)
}

/// Lists all channels across the cluster.
pub async fn list_channels(&self) -> Result<Vec<responses::Channel>> {
let response = self.http_get("channels", None, None).await?;
Expand Down
9 changes: 8 additions & 1 deletion src/blocking_api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ where
Ok(response)
}

/// Lists all client connections across the cluster.
/// Lists all AMQP 1.0 and 0-9-1 client connections across the cluster.
pub fn list_connections(&self) -> Result<Vec<responses::Connection>> {
let response = self.http_get("connections", None, None)?;
let response = response.json()?;
Expand Down Expand Up @@ -296,6 +296,13 @@ where
Ok(response)
}

/// Lists all RabbitMQ Stream Protocol client connections across the cluster.
pub fn list_stream_connections(&self) -> Result<Vec<responses::Connection>> {
let response = self.http_get("stream/connections", None, None)?;
let response = response.json()?;
Ok(response)
}

/// Lists all channels across the cluster.
pub fn list_channels(&self) -> Result<Vec<responses::Channel>> {
let response = self.http_get("channels", None, None)?;
Expand Down
13 changes: 13 additions & 0 deletions tests/connection_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,3 +51,16 @@ fn test_list_virtual_host_connections() {
result1
);
}

#[test]
fn test_list_stream_connections() {
let endpoint = endpoint();
let rc = Client::new(&endpoint, USERNAME, PASSWORD);

let result1 = rc.list_stream_connections();
assert!(
result1.is_ok(),
"list_stream_connections returned {:?}",
result1
);
}

0 comments on commit 114331c

Please sign in to comment.