Spring Boot REST API for tracking email, phone, and in-person interactions with agents.
Agents and interactions are held in an in-memory store (ConcurrentHashMap-backed
repositories) — state resets on restart. There is no database.
mvn spring-boot:run
The API listens on http://localhost:8080.
| Method | Path | Description |
|---|---|---|
| POST | /api/agents/{agentId}/interactions/email |
Log an email interaction |
| POST | /api/agents/{agentId}/interactions/phone |
Log a phone interaction |
| POST | /api/agents/{agentId}/interactions/in-person |
Log an in-person interaction |
| GET | /api/agents/{agentId}/interactions?type= |
List an agent's interactions (optional type filter: EMAIL, PHONE, IN_PERSON) |
| GET | /api/interactions/{id} |
Get a single interaction |
| DELETE | /api/interactions/{id} |
Delete an interaction |
Two consumers keep the in-memory store in sync with an upstream system of record:
Each message carries an eventType of CREATED, UPDATED, or DELETED plus the
full record; the listener upserts or deletes the matching entry in the in-memory
store. Broker location is set via spring.kafka.bootstrap-servers
(env var KAFKA_BOOTSTRAP_SERVERS, defaults to localhost:9092).
Example agent event payload:
{
"eventType": "UPDATED",
"id": 42,
"name": "Jane Doe",
"email": "jane.doe@example.com",
"phoneNumber": "555-0100"
}
