Re: Re-key by multiple properties without composite key

2024-02-07 Thread Karsten Stöckmann
Matthias, thank you for getting back on this. - I'll just let the application run for now. We are trying to build a CDC system leveraging Kafka in order to feed aggregated data into an indexing solution like Elasticsearch or Opensearch. Maybe after all the Kafka Streams application will be

Re: Re-key by multiple properties without composite key

2024-02-07 Thread Matthias J. Sax
Using the DSL, this sounds about right. I am not worried about the complexity -- KS can handle it, and it's not uncommon to end up with such topologies. You might be able to cut down on complexity by not using the DSL, but the Processor API. It gives you more control, and thus you might be

Re: Re-key by multiple properties without composite key

2024-02-07 Thread Karsten Stöckmann
Sorry for being late with the response - I've been quite busy working on our Streams application lately. That leads me back to my initial question. The Folder class contains multiple fields with FK pointing to the Person table, all of them with different semantics (customer, billing address,

Re: Re-key by multiple properties without composite key

2024-02-01 Thread Matthias J. Sax
I see. You need to ensure that you get _all_ Person. For this case, I guess you are right. You would need to first aggregate the folder per person: KTable allPersonFolders = folder.groupBy((...) -> (folder.customerId, ...)) .aggregate(...) And in a second step, do a left join:

Re: Re-key by multiple properties without composite key

2024-02-01 Thread Karsten Stöckmann
Thanks so much for taking a look. An FK-table-table join is an inner join which implies there would be no Person entites without associated Folders. Unfortunately, that's not the case. That lead me to an attempt of re-keying the Folder topic by each of the three possible foreign keys in order to

Re: Re-key by multiple properties without composite key

2024-01-31 Thread Matthias J. Sax
Thanks for the details. This does make sense. So it seems you can read all topic as table (ie, builder.table("topic") -- no need to so `builder.stream().toTable()`). And you can use the built-in FK-table-table join, and aggregate the result: KTable result = folderTable

Re: Re-key by multiple properties without composite key

2024-01-30 Thread Karsten Stöckmann
Matthias, thanks for getting back on this. I'll try to illustrate my intent with an example as I'm not yet fully familiar with Kafka (Streams) and its idioms... Assume classes Person and Folder: class Person { Long id; String firstname; String lastname; // some content } class Folder {

Re: Re-key by multiple properties without composite key

2024-01-30 Thread Matthias J. Sax
Both fk1 and fk2 point to the PK of another entity (not shown for brevity, of no relevance to the question). It this two independent FK, or one two-column FK? Ingesting the topic into a Kafka Streams application, how can I re-key the resulting KTable by both fk1 and fk2? If you read the

Re-key by multiple properties without composite key

2024-01-28 Thread Karsten Stöckmann
Hi all, just stumbled upon another Kafka Streams issue that keeps me busy these days. Assume a (simplified) class A like this: class A { private Long id; private String someContent; private Long fk1; private Long fk2; // Getters and setters accordingly } Both fk1 and fk2