Mapping
Learn about Kafka Streams’ map and mapValues operators.
We'll cover the following
To fulfill the next requirement, we’ll be using one of the most common operations in data streaming—mapping. Let’s refresh our memory about the requirements:
We have at our disposal three APIs:
An API to get the lyrics of a track by its ID.
An API to get a list of feelings associated with a track by its ID based on the analysis of the music itself.
An API to get a list of feelings associated with a text.
Our data scientists found that if a song has lyrics, they are more important than the music for the feelings analysis.
For noninstrumental tracks, we should be using an API to get the lyrics of the track. We need an operator that receives a record of one type as an input (Track
) and returns a single record of a different type (String
) in a 1:1 manner. For this use case, mapping is the perfect tool!
Get hands-on with 1400+ tech skills courses.