Low-level design – Timeline Service
Timeline Service is responsible for generating and serving user timelines in the Twitter-like service. It aggregates tweets from the users a person follows and presents them in chronological order. Let’s explore the low-level design of Timeline Service. We have already seen in Figure 11.2 how Tweet Service posts the incoming tweet to Timeline Service via a message queue (Kafka).
Timeline Service will expose the following API endpoints:
GET /timeline/{userId}
– retrieve the user’s home timeline:- Request: User authentication token
- Response: List of tweet objects representing the user’s timeline
GET /timeline/{userId}/mentions
– retrieve the user’s mentions timeline:- Request: User authentication token
- Response: List of tweet objects mentioning the user
Given that we have the API endpoints listed, we will now check the data flow.
Data flow
Timeline Service relies...