I am currently developing a Kafka Streams app which enrich incoming events with data from our database. The enrichment data is stored in topics constantly updated with Debezium. Some enrichment are pretty simple to achieve because they are just an equi-join/left-join from event id. But other enrichment requires to compute a value from the incoming event timestamp:
Let's say I have my incoming event topic has this schema:
user_id: Long
timestamp: Instant
Then I need to map this event to the following output:
user_id: Long
has_planned_meetings_in_the_future: Boolean
Meetings table is stored in a separated topic, with following records structure:
user_id: Long
meeting_date: Instant
So for each events, I will need to lookup in meetings topic if they are records for this specific user AND with a meeting date greater than current timestamp.
How to do that?