cdc streaming ingestion

    by claude-dev-suite

    1

    Implement real-time RAG ingestion using CDC, Kafka, and idempotent vector database upserts.

    Free

    3 usesSecurity scanned

    Works with the AI Agents you already use

    cdc streaming ingestion

    Example session with this skill installed

    Set up a Postgres CDC pipeline using Debezium and Kafka to sync my 'articles' table to a Qdrant vector store with exactly-once semantics.

    • Read your context and instructions
    • Compiled the cdc streaming ingestion

    I have configured the CDC pipeline for real-time document ingestion. This setup includes the Postgres publication, the Debezium connector configuration, and a Python consumer that handles idempotent upserts to Qdrant.

    Real-Time RAG Ingestion Pipeline

    1. Postgres Publication and Slot

    -- Enable logical replication and create publication
    ALTER SYSTEM SET wal_level = 'logical';
    SELECT pg_reload_conf();
    CREATE PUBLICATION rag_pub FOR TABLE articles;
    SELECT pg_create_logical_replication_slot('debezium_rag', 'pgoutput');
    

    2. Debezium Connector Configuration

    {
      "name": "postgres-articles-connector",
      "config": {
        "connector.class": "io.debezium.connector.postgresql.PostgresConnector",
        "database.hostname": "db-host",
        "database.port": "5432",
        "database.dbname": "app_db",
        "plugin.name": "pgoutput",
        "slot.name": "debezium_rag",
        "publication.name": "rag_pub",
        "tombstones.on.delete": "true",
        "key.converter": "org.apache.kafka.connect.json.JsonConverter",
        "value.converter": "org.apache.kafka.connect.json.JsonConverter"
      }
    }
    

    3. Idempotent Python Consumer

    ComponentImplementation Detail
    IdentityPoint IDs generated as {doc_id}-{chunk_index} for stable updates
    OrderingKafka partition key pinned to Primary Key to ensure sequential processing
    ConsistencyLSN (Log Sequence Number) stored in payload to skip stale/replay events
    DeletesExplicit handling of op: d and Kafka tombstone (null) messages
    async def idempotent_upsert(qdrant, point, event_lsn):
        # Retrieve existing LSN to prevent out-of-order overwrites
        existing = await qdrant.retrieve(collection_name="kb", ids=[point.id])
        if existing and existing[0].payload.get("lsn", 0) >= event_lsn:
            return 
        await qdrant.upsert(collection_name="kb", points=[point])
    

    Next steps

    • Deploy the Debezium connector to your Kafka Connect cluster.
    • Monitor pg_replication_slots to ensure the slot doesn't grow indefinitely.
    • Initialize the Qdrant collection with a payload index on doc_id for efficient deletes.

    Connects securely to your tools. The creator never sees your data.

    About this skill

    The problem

    Scheduled batch ingestion leaves your vector database stale for hours. When high-throughput source data changes rapidly or compliance requires immediate deletion, batch processing cannot keep up with the freshness demands of real-time RAG applications.

    What it does

    • Configures Debezium and Postgres logical replication to capture row-level changes.
    • Implements Kafka-based stream processing for embedding and upserting documents.
    • Enforces exactly-once semantics through idempotent vector DB writes and LSN tracking.
    • Handles document updates, deletes, and tombstones to ensure vector store consistency.
    • Provides strategies for schema evolution and blue-green re-indexing during model upgrades.

    Frameworks & tools

    Postgres (WAL/Logical Replication), Debezium, Apache Kafka, Apache Flink, Python (aiokafka), Qdrant, and OpenAI Embeddings.

    Why this beats prompting it yourself

    Building streaming RAG requires solving complex distributed systems problems like late-arriving updates and offset management. This skill provides the specific infrastructure configurations and consumer logic needed to prevent data loss and WAL accumulation that generic prompts overlook.

    Use cases

    • Propagating sensitive data deletions to vector stores for GDPR compliance.
    • Maintaining sub-10s freshness for RAG systems powered by high-traffic databases.
    • Enriching document streams with temporal joins using Flink SQL.
    • Scaling embedding pipelines for ingestion rates exceeding 100 writes per second.

    Known limitations

    Vector databases typically lack transactional parity with Kafka, requiring the idempotent upsert patterns provided here rather than native EOS.

    How to use

    1. 1

      Connect your agent to the Agensi MCP

      Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup

    2. 2

      Sign in to Agensi

      Your agent shows a sign-in link. Sign in and click Allow.

    3. 3

      Ask for what you need

      Your agent loads this skill and uses it on your task. It always asks before buying a skill.

    Reviews

    No reviews yet

    Be one of the first to try it. Every listed skill goes through the trust checks below.

    Security scanned

    Checked by our 8-point scan before listing

    3 uses

    Times used to date

    Free to use

    No account required to browse

    Trust & safety

    Security scan

    Security scan passed 2 months ago

    • Free with an Agensi account

    Permissions

    Terminal / Shell
    Listed2 months ago

    What's inside

    Frequently Asked Questions

    This skill enables sub-10 second data freshness by capturing row-level database changes (CDC) and streaming them directly to your vector database, eliminating the 'staleness' lag found in traditional batch processing.

    The package includes Debezium/Kafka configurations, consumer logic for Python (aiokafka), Flink SQL enrichment scripts, and idempotent upsert patterns designed specifically for Qdrant and similar vector stores.

    Yes, the skill includes specialized logic for handling delete events and 'tombstones' from the source database, ensuring that sensitive or deleted information is immediately purged from your vector index for compliance.

    You will need a Postgres instance with logical replication enabled, an Apache Kafka cluster, and a destination vector database like Qdrant; the skill provides the orchestration logic to connect them.

    While optimized for Postgres and Qdrant, the Kafka-centric architecture is highly modular, allowing you to swap in other SQL sources or different vector providers with minimal adjustment to the core consumer logic.

    This skill implements LSN (Log Sequence Number) tracking and idempotent write patterns, which prevent duplicate entries or out-of-order updates from corrupting your vector embeddings during network flickers.

    New in LLM Ops

    Find more skills like this on the Claude Skills Marketplace, the Codex Skills Marketplace and the Gemini Skills Marketplace, or browse Claude Skills for LLM Ops.

    Free