Menu

Post image 1
Post image 2
1 / 2
0

Vectorizing Real-Time Kafka Events

DEV Community·Pedro Santos·21 days ago
#9xcG4hbD
Reading 0:00
15s threshold

Vectorizing Real-Time Kafka Events for RAG In the previous post, I set up pgvector and Ollama for embedding and vector search. Now I need to fill the database with data. Not documents or PDFs. Real-time saga events flowing through Kafka. Every time a saga finishes (success or failure), the system publishes to a notify-ending topic. My AI agent listens to that topic and vectorizes every event. Over time, this builds a searchable history of all saga executions. The Kafka Consumer The entry point is a standard Spring Kafka listener: @KafkaListener ( groupId = "${spring.kafka.consumer.group-id}" , topics = "${spring.kafka.topic.notify-ending}" ) public void onSagaEnded ( String payload ) { var event = parseEvent ( payload ). orElse ( null ); if ( event == null ) { log . warn ( "[OperationsService] Failed to parse event payload" ); return ; } // Vectorize ALL events for learning String historyText = buildHistoryText ( event ); vectorize ( event , historyText ); // Diagnose only failures if ( event .…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.

Read More