Reputation: 479
The use case that I am trying to tackle is as follows:
So for example :
Questions:
Upvotes: 1
Views: 1654
Reputation: 62285
A custom partitioner would help, but it is not necessary for you case.
You can just extract the grouping value from you messages and use it as grouping-key. Thus, after the sources read the data, you use a map
to extract the value (eg, Record -> (groupingValue, Record) with data types byte[] -> Tuple2<keyType,byte[]>
if you want to keep the raw message). Afterwards, you can use .keyBy(0)
and apply whatever operator you want on it. keyBy
ensures, that all records with the same value in the first field of Tuple2
are processed by the same operator.
Upvotes: 2