Fix RabbitAmqpAdmin.purgeQueue for proper return

The `Management.queuePurge()` now returns a `PurgeStatus` abstraction,
where the `messageCount` property is what we expect on the `AmqpAdmin` contract.

Related to: https://github.com/rabbitmq/rabbitmq-amqp-java-client/issues/151
This commit is contained in:
Artem Bilan
2025-03-17 16:22:15 -04:00
parent d3de2febc6
commit d6ded3fca2

View File

@@ -402,9 +402,8 @@ public class RabbitAmqpAdmin
@ManagedOperation(description = "Purge a queue and return the number of messages purged")
public int purgeQueue(String queueName) {
try (Management management = getManagement()) {
management.queuePurge(queueName);
return (int) management.queuePurge(queueName).messageCount();
}
return 0;
}
@Override