1

I have messages in topic (compact topic):

{id: 1, groupId: 1}
{id: 2, groupId: 1}
{id: 3, groupId: 1}
{id: 4, groupId: 2}

I want grouped messages by groupId and then get all possible combinations in each group. For example for groupId=1 combinations: id:1-id:2, id:1-id:3, id:2-id:3.

How can I do this?

Maybe self-join streams?

Svyat
  • 33
  • 5

1 Answers1

2

Use map operator to move the groupId over to the record key, then groupByKey

Otherwise, use aggregate operator and reduce by the value's groupId

OneCricketeer
  • 179,855
  • 19
  • 132
  • 245