feat(kafka): support Kafka MQ admin client

This commit is contained in:
miracle authored and GitHub committed 2026-06-30 17:01:24 +08:00
1 parent 3e7cf30ce5
commit 7cec4892bf
43 files changed
+4281 -186

No files matched your search

+2
View File
@@ -141,7 +141,9 @@ fn add_mq_routes(router: Router<Arc<WebState>>) -> Router<Arc<WebState>> {
.route("/mq/tokens/issue", post(routes::mq::issue_token))
.route("/mq/tokens/list", post(routes::mq::list_token_records))
.route("/mq/monitoring/backlog", post(routes::mq::get_backlog))
.route("/mq/monitoring/cluster-info", post(routes::mq::get_cluster_info))
.route("/mq/raw", post(routes::mq::raw_request))
.route("/mq/send-message", post(routes::mq::send_message))
}
#[cfg(not(feature = "mq-admin"))]
+33
View File
@@ -698,6 +698,21 @@ pub async fn get_backlog(
Ok(Json(result))
}
#[derive(serde::Deserialize)]
#[serde(rename_all = "camelCase")]
pub(crate) struct ClusterInfoReq {
connection_id: String,
}
pub async fn get_cluster_info(
State(state): State<Arc<WebState>>,
Json(req): Json<ClusterInfoReq>,
) -> Result<Json<dbx_core::mq::ClusterInfo>, AppError> {
let result =
dbx_core::mq::service::mq_get_cluster_info_core(&state.app, &req.connection_id).await.map_err(AppError)?;
Ok(Json(result))
}
pub async fn raw_request(
State(state): State<Arc<WebState>>,
Json(req): Json<RawRequestReq>,
@@ -709,3 +724,21 @@ pub async fn raw_request(
dbx_core::mq::service::mq_raw_request_core(&state.app, &req.connection_id, req.req).await.map_err(AppError)?;
Ok(Json(result))
}
// ---- Message production ----
#[derive(serde::Deserialize)]
#[serde(rename_all = "camelCase")]
pub(crate) struct SendMessageReq {
connection_id: String,
req: dbx_core::mq::SendMessageRequest,
}
pub async fn send_message(
State(state): State<Arc<WebState>>,
Json(req): Json<SendMessageReq>,
) -> Result<Json<dbx_core::mq::SendMessageResponse>, AppError> {
let result =
dbx_core::mq::service::mq_send_message_core(&state.app, &req.connection_id, req.req).await.map_err(AppError)?;
Ok(Json(result))
}