fix(rabbitmq): add bounded paging for queue and exchange management lists

Closes #8879
This commit is contained in:
t8y2 committed 2026-09-27 09:38:54 +00:00
1 parent 33f212a452
commit 725b1ee252
22 files changed
+1445 -67

No files matched your search

+2
View File
@@ -310,6 +310,7 @@ fn add_mq_routes(router: Router<Arc<WebState>>) -> Router<Arc<WebState>> {
.route("/mq/namespaces/delete", post(routes::mq::delete_namespace))
.route("/mq/namespaces/policies", post(routes::mq::get_namespace_policies))
.route("/mq/topics/list", post(routes::mq::list_topics))
.route("/mq/topics/list-page", post(routes::mq::list_topics_page))
.route("/mq/topics/create", post(routes::mq::create_topic))
.route("/mq/topics/delete", post(routes::mq::delete_topic))
.route("/mq/topics/update-partitions", post(routes::mq::update_partitions))
@@ -319,6 +320,7 @@ fn add_mq_routes(router: Router<Arc<WebState>>) -> Router<Arc<WebState>> {
.route("/mq/topics/alter-config", post(routes::mq::alter_topic_config))
.route("/mq/topics/skip-accumulation", post(routes::mq::skip_topic_accumulation))
.route("/mq/exchanges/list", post(routes::mq::list_exchanges))
.route("/mq/exchanges/list-page", post(routes::mq::list_exchanges_page))
.route("/mq/exchanges/create", post(routes::mq::create_exchange))
.route("/mq/exchanges/delete", post(routes::mq::delete_exchange))
.route("/mq/bindings/list", post(routes::mq::list_bindings))
+48
View File
@@ -90,6 +90,15 @@ pub(crate) struct ListTopicsReq {
opts: dbx_core::mq::ListTopicsOpts,
}
#[derive(serde::Deserialize)]
#[serde(rename_all = "camelCase")]
pub(crate) struct ListTopicsPageReq {
connection_id: String,
ns: dbx_core::mq::NamespaceRef,
opts: dbx_core::mq::ListTopicsOpts,
pagination: dbx_core::mq::MqListPageRequest,
}
#[derive(serde::Deserialize)]
#[serde(rename_all = "camelCase")]
pub(crate) struct CreateTopicReq {
@@ -129,6 +138,14 @@ pub(crate) struct ListExchangesReq {
ns: dbx_core::mq::NamespaceRef,
}
#[derive(serde::Deserialize)]
#[serde(rename_all = "camelCase")]
pub(crate) struct ListExchangesPageReq {
connection_id: String,
ns: dbx_core::mq::NamespaceRef,
pagination: dbx_core::mq::MqListPageRequest,
}
#[derive(serde::Deserialize)]
#[serde(rename_all = "camelCase")]
pub(crate) struct CreateExchangeReq {
@@ -591,6 +608,24 @@ pub async fn list_topics(
Ok(Json(result))
}
pub async fn list_topics_page(
State(state): State<Arc<WebState>>,
headers: HeaderMap,
Json(req): Json<ListTopicsPageReq>,
) -> Result<Json<dbx_core::mq::MqListPage<dbx_core::mq::TopicInfo>>, AppError> {
super::mcp_policy::ensure_scope(&state, &headers, &req.connection_id).await?;
let result = dbx_core::mq::service::mq_list_topics_page_core(
&state.app,
&req.connection_id,
req.ns,
req.opts,
req.pagination,
)
.await
.map_err(AppError::from)?;
Ok(Json(result))
}
pub async fn create_topic(
State(state): State<Arc<WebState>>,
headers: HeaderMap,
@@ -666,6 +701,19 @@ pub async fn list_exchanges(
Ok(Json(result))
}
pub async fn list_exchanges_page(
State(state): State<Arc<WebState>>,
headers: HeaderMap,
Json(req): Json<ListExchangesPageReq>,
) -> Result<Json<dbx_core::mq::MqListPage<dbx_core::mq::MqExchangeInfo>>, AppError> {
super::mcp_policy::ensure_scope(&state, &headers, &req.connection_id).await?;
let result =
dbx_core::mq::service::mq_list_exchanges_page_core(&state.app, &req.connection_id, req.ns, req.pagination)
.await
.map_err(AppError::internal)?;
Ok(Json(result))
}
pub async fn create_exchange(
State(state): State<Arc<WebState>>,
headers: HeaderMap,