Prism is an industrial-grade, high-throughput distributed search and discovery engine built on the CQRS (Command Query Responsibility Segregation) pattern. It leverages modern Java 21 capabilities to provide real-time data synchronization between a relational source of truth and a full-text search Read-Model.
The project implements a resilient event-driven pipeline:
- Command Side (Write-Model): A Spring Boot service managing event ingestion into PostgreSQL.
- CDC Bridge: Debezium monitors Postgres WAL (Write-Ahead Logs) and streams changes to Kafka.
- Query Side (Read-Model): A high-concurrency service consuming Kafka signals to project data into Elasticsearch.
- Java 21 Virtual Threads (Project Loom): Optimized for high-throughput I/O between Kafka and Elasticsearch without thread starvation.
- Change Data Capture (CDC): Real-time synchronization using Debezium, ensuring the Read-Model is eventually consistent with the Source of Truth.
- Advanced Discovery:
- Fuzzy Search: Typo-tolerant querying using Elasticsearch Native Query DSL.
- Hit Highlighting: Automatic HTML match indication (
<em>tags) in search results for enhanced UX.
- Production Resilience:
- Non-blocking Retries: Exponential backoff strategy for transient failures.
- Dead Letter Topics (DLT): Fault-tolerant event handling to prevent data loss.
- Industrial Standards: Multi-module Maven architecture, strictly typed DTOs using Java Records, and conventional git-flow.
- Runtime: Java 21 (Virtual Threads enabled)
- Framework: Spring Boot 3.4.2
- Database: PostgreSQL 16 (Logical Replication)
- Messaging: Apache Kafka
- Search Engine: Elasticsearch 8.11
- Ingestion: Debezium Connect
- Build Tool: Maven (Multi-Module)
prism/
├── prism-command-service/ # Write Model (API → PostgreSQL)
├── prism-search-service/ # Read Model (Kafka → Elasticsearch → Search API)
├── docker-compose.yml # Infrastructure orchestration
└── pom.xml # Parent POM & dependency management
## 🚦 Getting Started
### Prerequisites
- Java 21 SDK
- Maven 3.9+
- Docker & Docker Compose
Spin up the distributed backbone:
docker-compose up -dBuild & Run From the root directory:
mvn clean install -DskipTests
cd prism-command-service && ./mvnw spring-boot:run
cd prism-search-service && ./mvnw spring-boot:run
Endpoint
POST http://localhost:8080/api/v1/events
Payload
{
"title": "Smile Khan Flagship Project",
"category": "ENGINEERING",
"metadata": {
"status": "active"
}
}Endpoint: POST http://localhost:8081/api/v1/discovery/search
Payload
{
"query": "Flagship",
"category": "ENGINEERING",
"page": 0,
"size": 10
}Smile Khan
Java Backend Engineer | Distributed Systems & Event-Driven Architectures