Skip to content

Commit 17a22e4

Browse files
2.18.0
1 parent af5b54f commit 17a22e4

File tree

7 files changed

+92
-22
lines changed

7 files changed

+92
-22
lines changed

CHANGELOG.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,14 @@
11
# rabbitmqadmin-ng Change Log
22

3-
## v2.18.0 (in development)
3+
## v2.18.0 (Dec 11, 2025)
44

5-
No changes yet.
5+
### Enhancements
6+
7+
* `--page` and `--page-size` options for paginated listing of queues, streams, and connections
8+
9+
### Upgrades
10+
11+
* RabbitMQ HTTP API client was upgraded to [`0.70.0`](https://github.com/michaelklishin/rabbitmq-http-api-rs/releases/tag/v0.70.0)
612

713

814
## v2.17.0 (Nov 29, 2025)

Cargo.lock

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ reqwest = { version = "0.12", features = [
1717
"__rustls",
1818
"rustls-tls-native-roots",
1919
] }
20-
rabbitmq_http_client = { version = "0.68.0", features = [
20+
rabbitmq_http_client = { version = "0.70", features = [
2121
"blocking",
2222
"tabled",
2323
] }

src/cli.rs

Lines changed: 26 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -629,6 +629,21 @@ pub fn parser(pre_flight_settings: PreFlightSettings) -> Command {
629629
.subcommands(command_groups)
630630
}
631631

632+
fn pagination_args() -> [Arg; 2] {
633+
[
634+
Arg::new("page")
635+
.long("page")
636+
.help("page number (1-indexed)")
637+
.required(false)
638+
.value_parser(value_parser!(u64).range(1..)),
639+
Arg::new("page_size")
640+
.long("page-size")
641+
.help("number of results per page (default: 100, max: 500)")
642+
.required(false)
643+
.value_parser(value_parser!(u64).range(1..=500)),
644+
]
645+
}
646+
632647
fn list_subcommands(pre_flight_settings: PreFlightSettings) -> Vec<Command> {
633648
let nodes_cmd = Command::new("nodes").long_about("Lists cluster members");
634649
let vhosts_cmd = Command::new("vhosts")
@@ -648,7 +663,8 @@ fn list_subcommands(pre_flight_settings: PreFlightSettings) -> Vec<Command> {
648663
.after_help(color_print::cformat!(
649664
"<bold>Doc guide</bold>: {}",
650665
CONNECTION_GUIDE_URL
651-
));
666+
))
667+
.args(pagination_args());
652668
let channels_cmd = Command::new("channels")
653669
.long_about("Lists AMQP 0-9-1 channels")
654670
.after_help(color_print::cformat!(
@@ -660,7 +676,8 @@ fn list_subcommands(pre_flight_settings: PreFlightSettings) -> Vec<Command> {
660676
.after_help(color_print::cformat!(
661677
"<bold>Doc guide</bold>: {}",
662678
QUEUE_GUIDE_URL
663-
));
679+
))
680+
.args(pagination_args());
664681
let exchanges_cmd = Command::new("exchanges").long_about("Lists exchanges");
665682
let bindings_cmd = Command::new("bindings").long_about("Lists bindings");
666683
let consumers_cmd = Command::new("consumers")
@@ -1578,7 +1595,8 @@ fn queues_subcommands(pre_flight_settings: PreFlightSettings) -> Vec<Command> {
15781595
.after_help(color_print::cformat!(
15791596
"<bold>Doc guide</bold>: {}",
15801597
QUEUE_GUIDE_URL
1581-
));
1598+
))
1599+
.args(pagination_args());
15821600
let purge_cmd = Command::new("purge")
15831601
.long_about("Purges (permanently removes unacknowledged messages from) a queue")
15841602
.arg(
@@ -1647,11 +1665,12 @@ fn streams_subcommands(pre_flight_settings: PreFlightSettings) -> Vec<Command> {
16471665
)
16481666
.arg(idempotently_arg.clone());
16491667
let list_cmd = Command::new("list")
1650-
.long_about("Lists streams and queues and")
1668+
.long_about("Lists streams and queues")
16511669
.after_help(color_print::cformat!(
16521670
"<bold>Doc guide</bold>: {}",
16531671
STREAM_GUIDE_URL
1654-
));
1672+
))
1673+
.args(pagination_args());
16551674
[declare_cmd, delete_cmd, list_cmd]
16561675
.into_iter()
16571676
.map(|cmd| cmd.infer_long_args(pre_flight_settings.infer_long_options))
@@ -2381,7 +2400,8 @@ fn connections_subcommands(pre_flight_settings: PreFlightSettings) -> Vec<Comman
23812400
.after_help(color_print::cformat!(
23822401
"<bold>Doc guide</bold>: {}",
23832402
CONNECTION_GUIDE_URL
2384-
));
2403+
))
2404+
.args(pagination_args());
23852405
let list_user_connections_cmd = Command::new("list_of_user")
23862406
.arg(
23872407
Arg::new("username")

src/commands.rs

Lines changed: 32 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ use clap::ArgMatches;
2121
use rabbitmq_http_client::blocking_api::Client;
2222
use rabbitmq_http_client::blocking_api::Result as ClientResult;
2323
use rabbitmq_http_client::commons;
24+
use rabbitmq_http_client::commons::PaginationParams;
2425
use rabbitmq_http_client::commons::QueueType;
2526
use rabbitmq_http_client::commons::{
2627
BindingDestinationType, ChannelUseMode, TlsPeerVerificationMode,
@@ -102,8 +103,27 @@ pub fn list_users(client: APIClient) -> ClientResult<Vec<responses::User>> {
102103
client.list_users()
103104
}
104105

105-
pub fn list_connections(client: APIClient) -> ClientResult<Vec<responses::Connection>> {
106-
client.list_connections()
106+
pub fn list_connections(
107+
client: APIClient,
108+
command_args: &ArgMatches,
109+
) -> ClientResult<Vec<responses::Connection>> {
110+
let pagination = extract_pagination_params(command_args);
111+
match pagination {
112+
Some(params) => client.list_connections_paged(&params),
113+
None => client.list_connections(),
114+
}
115+
}
116+
117+
fn extract_pagination_params(command_args: &ArgMatches) -> Option<PaginationParams> {
118+
let page = command_args.get_one::<u64>("page").map(|&v| v as usize);
119+
let page_size = command_args
120+
.get_one::<u64>("page_size")
121+
.map(|&v| v as usize);
122+
if page.is_some() || page_size.is_some() {
123+
Some(PaginationParams { page, page_size })
124+
} else {
125+
None
126+
}
107127
}
108128

109129
pub fn list_user_connections(
@@ -233,8 +253,16 @@ pub fn list_matching_operator_policies_in(
233253
.collect())
234254
}
235255

236-
pub fn list_queues(client: APIClient, vhost: &str) -> ClientResult<Vec<responses::QueueInfo>> {
237-
client.list_queues_in(vhost)
256+
pub fn list_queues(
257+
client: APIClient,
258+
vhost: &str,
259+
command_args: &ArgMatches,
260+
) -> ClientResult<Vec<responses::QueueInfo>> {
261+
let pagination = extract_pagination_params(command_args);
262+
match pagination {
263+
Some(params) => client.list_queues_in_paged(vhost, &params),
264+
None => client.list_queues_in(vhost),
265+
}
238266
}
239267

240268
pub fn list_exchanges(

src/main.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -466,7 +466,7 @@ fn dispatch_common_subcommand(
466466
res_handler.no_output_on_success(result);
467467
}
468468
("connections", "list") => {
469-
let result = commands::list_connections(client);
469+
let result = commands::list_connections(client, second_level_args);
470470
res_handler.tabular_result(result)
471471
}
472472
("connections", "list_of_user") => {
@@ -748,7 +748,7 @@ fn dispatch_common_subcommand(
748748
res_handler.tabular_result(result)
749749
}
750750
("list", "connections") => {
751-
let result = commands::list_connections(client);
751+
let result = commands::list_connections(client, second_level_args);
752752
res_handler.tabular_result(result)
753753
}
754754
("list", "consumers") => {
@@ -792,7 +792,7 @@ fn dispatch_common_subcommand(
792792
res_handler.tabular_result(result)
793793
}
794794
("list", "queues") => {
795-
let result = commands::list_queues(client, &vhost);
795+
let result = commands::list_queues(client, &vhost, second_level_args);
796796
res_handler.tabular_result(result)
797797
}
798798
("list", "user_connections") => {
@@ -1038,7 +1038,7 @@ fn dispatch_common_subcommand(
10381038
res_handler.delete_operation_result(result);
10391039
}
10401040
("queues", "list") => {
1041-
let result = commands::list_queues(client, &vhost);
1041+
let result = commands::list_queues(client, &vhost, second_level_args);
10421042
res_handler.tabular_result(result)
10431043
}
10441044
("queues", "purge") => {
@@ -1169,7 +1169,7 @@ fn dispatch_common_subcommand(
11691169
res_handler.delete_operation_result(result);
11701170
}
11711171
("streams", "list") => {
1172-
let result = commands::list_queues(client, &vhost);
1172+
let result = commands::list_queues(client, &vhost, second_level_args);
11731173
res_handler.tabular_result(result)
11741174
}
11751175
("users", "connections") => {

tests/exchanges_tests.rs

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,15 @@ fn list_exchanges() -> Result<(), Box<dyn Error>> {
4444
.and(output_includes(x2).not()),
4545
);
4646

47-
run_succeeds(["-V", vh1, "delete", "exchange", "--name", x1]);
47+
run_succeeds([
48+
"-V",
49+
vh1,
50+
"delete",
51+
"exchange",
52+
"--name",
53+
x1,
54+
"--idempotently",
55+
]);
4856

4957
run_succeeds(["-V", vh1, "list", "exchanges"]).stdout(
5058
output_includes("amq.direct")
@@ -91,7 +99,15 @@ fn exchanges_list() -> Result<(), Box<dyn Error>> {
9199
.and(output_includes(x2).not()),
92100
);
93101

94-
run_succeeds(["-V", vh1, "exchanges", "delete", "--name", x1]);
102+
run_succeeds([
103+
"-V",
104+
vh1,
105+
"exchanges",
106+
"delete",
107+
"--name",
108+
x1,
109+
"--idempotently",
110+
]);
95111

96112
run_succeeds(["-V", vh1, "exchanges", "list"]).stdout(
97113
output_includes("amq.direct")

0 commit comments

Comments
 (0)