Lets say that I have three Kafka topics filled with events representing business events occuring in different aggregates (event sourcing application). These events allow to build aggregates with following attributes :
- users : usedId, name
- modules of an application : moduleId, name
- grants of users for modules of application : grantId, userId, moduleId, scope
Now I want to create a stream of all grants with name of users and products (instead of id). I thought to do so :
- create a KTable for users by grouping events by userId. The KTable has userId as key. It is ok.
- create a KTable for products by grouping events by productId. The KTable has productId as key. It is ok.
- create a stream from the stream of Grants and joining on the two KTable. It is no ok. The problem is that joins seem only possible on primary keys. But the key of the stream is an technical identifier of the Grant and keys of users and products tables are not (they are agnostic of Grant).
So how to proceed ?
userIdfield to join to the Users table, and themoduleIdfield to join to the Modules table. The key of Grants stream isgrantId. - gentiane