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

+4 -2
View File
@@ -735,7 +735,8 @@ pub async fn test_connection(state: State<'_, Arc<AppState>>, config: Connection
#[cfg(feature = "mq-admin")]
DatabaseType::MessageQueue => {
let mqc = state.mq_admin_config_for_connection(connection_id, &config).await?;
let adapter = state.mq_registry.build_transient_config(mqc).await?;
let kafka_launch = dbx_core::mq::service::resolve_kafka_launch_spec(&mqc, &state);
let adapter = state.mq_registry.build_transient_config(mqc, kafka_launch).await?;
adapter.test_connection().await?;
Ok("Connection successful".to_string())
}
@@ -1018,7 +1019,8 @@ pub async fn connect_db(state: State<'_, Arc<AppState>>, config: ConnectionConfi
#[cfg(feature = "mq-admin")]
DatabaseType::MessageQueue => {
let mqc = state.mq_admin_config_for_connection(&id, &config).await?;
let adapter = state.mq_registry.build_transient_config(mqc).await?;
let kafka_launch = dbx_core::mq::service::resolve_kafka_launch_spec(&mqc, &state);
let adapter = state.mq_registry.build_transient_config(mqc, kafka_launch).await?;
adapter.test_connection().await?;
PoolKind::MessageQueue
}
+19
View File
@@ -433,6 +433,14 @@ pub async fn mq_get_backlog(
dbx_core::mq::service::mq_get_backlog_core(&state, &connection_id, topic, sub).await
}
#[tauri::command]
pub async fn mq_get_cluster_info(
state: State<'_, Arc<AppState>>,
connection_id: String,
) -> Result<dbx_core::mq::ClusterInfo, String> {
dbx_core::mq::service::mq_get_cluster_info_core(&state, &connection_id).await
}
// ---- Raw request (escape hatch) ----
#[tauri::command]
@@ -446,3 +454,14 @@ pub async fn mq_raw_request(
}
dbx_core::mq::service::mq_raw_request_core(&state, &connection_id, req).await
}
// ---- Message production ----
#[tauri::command]
pub async fn mq_send_message(
state: State<'_, Arc<AppState>>,
connection_id: String,
req: dbx_core::mq::SendMessageRequest,
) -> Result<dbx_core::mq::SendMessageResponse, String> {
dbx_core::mq::service::mq_send_message_core(&state, &connection_id, req).await
}