Customer DP Service

Data product service providing unified customer views by consuming policy and quote events and projecting them into a queryable customer aggregate.

Service Data Product

Overview

The Customer DP Service is a data product service within the Capstone PAS that provides a unified view of customer data. It consumes events from the Policy and Quote domains and projects them into a queryable customer aggregate stored in DynamoDB.

Architecture

  • Event Sourced Projection: Consumes domain events to build customer read model
  • Lambda-based Consumers: Separate Lambda functions for policy and quote events
  • DynamoDB Storage: Customer state stored in DynamoDB with GSI for efficient queries
  • Idempotent Processing: Logical clock readings ensure exactly-once semantics

Event Processing

Quote Events

The service consumes quote events via the quote-events SQS queue:

EventHandlerEffect
PolicyHolderAddedToQuoteEventPolicyHolderAddedToQuoteEventHandlerCreates customer if not exists, associates quote

Policy Events

The service consumes policy events via the policy-events SQS queue:

EventHandlerEffect
PolicyCreatedEventPolicyCreatedFromQuoteEventHandlerRemoves quote reference, adds policy to customer
PolicyCancelledEventPolicyCancelledEventHandlerUpdates policy status to CANCELLED
PolicyExpiredEventPolicyExpiredEventHandlerUpdates policy status to EXPIRED
PolicyVerificationCompletedEventPolicyVerificationCompletedEventHandlerUpdates policy status from verification result

Query Interface

The service exposes a single query endpoint:

QueryDescription
GetCustomerRetrieves customer by policy holder ID

Infrastructure

Kinesis (Policy Events) ─> SQS (policy-events) ─> Lambda (PolicyEventsHandler)
Kinesis (Quote Events) ─> SQS (quote-events) ─> Lambda (QuoteEventsHandler)
DynamoDB (Customer Table)
Lambda (GetCustomer API)

Replay Support

Failed events can be replayed through dedicated replay queues:

  • Policy events: Redrive from DLQ to policy-events queue
  • Quote events: Redrive from DLQ to quote-events queue

Invalid payloads are routed to Invalid Message Queues (IMQs) for investigation.