Stream 2 Stream Join with Partial Key

I see, so it actually seems that you could do a “manual” stream-table join, ie, you will need to use the Processor API to build it manually:

You can use two transform() with shared KeyValueStore. The first transform() will read the request topic, and buffers all requests in the state store. The second transform() processes the responses and does range lookups into the KeyValueStore() bases on Transaction Number, Message Number and produces the join results.

You will also need some “expiration” mechanism, that allows you to remove old requests from the state store. During this expiration, you might also need to emit “left join results” for requests with no responses – thus, you need to do some additional book keeping the the state store if a request was joined or not: when adding a new request to the store, this “joined flag” would be set to false, and if the a request is actually joined, you would need to update it to true.

In Apache Kafka 2.8.0, we added prefixScan() to KeyValuesStores that should be helpful.

1 Like