feat(cdc): live Debezium CDC consumer + /api/changes for the Changes dashboard
Add api/cdc_consumer.py: aiokafka background consumer subscribes to the CDC topics (postgres_sales/mysql_hr/mongodb_supplychain + cassandra/neo4j), parses Debezium before/after envelopes, keeps a ring buffer and publishes each change live as type=cdc_change. Endpoints /api/changes, /api/changes/stats, /status.
This commit is contained in:
@@ -43,6 +43,7 @@ from hadoop_analytics import router as hadoop_router
|
||||
from elasticsearch_api import router as elasticsearch_router
|
||||
from sql_console import router as sql_router
|
||||
from agent_ops import router as agent_ops_router, agent_dml_loop
|
||||
from cdc_consumer import router as cdc_router, cdc_consumer_loop
|
||||
from ssh_terminal import ssh_session
|
||||
from node_registry import NODE_IDS, NODE_AGENT, NODE_REGISTRY, is_node_id
|
||||
from node_ops import build_node_detail, probe_node, run_node_probe_task
|
||||
@@ -713,10 +714,12 @@ async def lifespan(app: FastAPI):
|
||||
await terminal_log(nid, f"{meta['label']} shell ready — click node to connect", level="info", phase="boot")
|
||||
task = asyncio.create_task(heartbeat_loop())
|
||||
dml_task = asyncio.create_task(agent_dml_loop())
|
||||
cdc_task = asyncio.create_task(cdc_consumer_loop())
|
||||
add_feed("infra-sentinel", "ATC Command Center API online", "info")
|
||||
yield
|
||||
task.cancel()
|
||||
dml_task.cancel()
|
||||
cdc_task.cancel()
|
||||
if redis_client:
|
||||
await redis_client.close()
|
||||
|
||||
@@ -729,6 +732,7 @@ app.include_router(hadoop_router)
|
||||
app.include_router(elasticsearch_router)
|
||||
app.include_router(sql_router)
|
||||
app.include_router(agent_ops_router)
|
||||
app.include_router(cdc_router)
|
||||
app.add_middleware(
|
||||
CORSMiddleware,
|
||||
allow_origins=["*"],
|
||||
|
||||
Reference in New Issue
Block a user