10.3 CDR Ingestion and Metering¶
Sprint: Sprint 10 - Usage Metering
Feature ID: 10.3
Subtasks: 10.3.1, 10.3.2
Objective¶
Deliver "CDR Ingestion and Metering" within Sprint 10 - Usage Metering.
Dependencies¶
Aggregated from the subtasks below (prerequisite task IDs and enablers):
- 3.3.1
- 10.2.1
- 10.3.1
Subtasks¶
10.3.1 CDR event schema and topic¶
- ID: 10.3.1
- Title: Define CDR Avro schema and topic
- Description: Define
cdr-recorded.v1(subscriptionId, type VOICE/SMS/DATA, quantity, occurredAt, cdrRef) in platform-event-contracts and ensure the topic exists. CDR is high-volume and replayable (analysis Section 9.1). - Business Purpose: Contract for the usage stream (FR-17).
- Inputs: analysis Section 8.5/9.1, event-catalog
usage.recorded.v1. - Outputs: Avro schema + topic.
- Acceptance Criteria:
- Schema generates a
CdrRecordedV1record; the topic accepts produced CDR events. - Dependencies: 3.3.1
- Complexity: S
10.3.2 CDR consumer and quota decrement¶
- ID: 10.3.2
- Title: Implement idempotent CDR consumer updating quota
- Description: Idempotent (inbox, keyed by cdrRef) consumer of
cdr-recorded.v1that records ausage_recordand atomically decrements the matching quota balance by type, emittingusage.recorded.v1. Concurrency-safe decrement (row lock / atomic update). - Business Purpose: Real-time quota metering from the CDR stream (FR-17).
- Inputs: FR-17, event-catalog
usage.recorded.v1. - Outputs: CDR consumer + decrement logic.
- Acceptance Criteria:
- A CDR event decrements the correct balance once (duplicate cdrRef ignored); concurrent events do not corrupt the balance (parallel test).
- Dependencies: 10.2.1, 10.3.1
- Complexity: L
Acceptance Criteria¶
Each subtask above carries its own objective, testable acceptance criteria. This feature is complete when every subtask's acceptance criteria are met.
Deliverables¶
- Avro schema + topic.
- CDR consumer + decrement logic.
Definition of Done¶
- All subtasks (10.3.1, 10.3.2) completed and their acceptance criteria verified.
- All listed dependencies satisfied.
- Build and tests green per the global conventions in ../README.md (Section 3).