Are records with a matching key from different inputs processed by the same node instances?

When using “topology.addProcessor” and passing two parents with compatible record keys, are records of a given key supposed to be treated by a single processor instance? Same question with “stream.merge” followed by “stream.process”.

Context

I’m learning Kafka streams and recently came to the conclusion that this should be the case following my study of the documentation and some tests. I wrote a custom processor which receives records from a topic and from the output of another processor (which is just a filter on another topic). My processor was working just fine when testing with a TopologyTestDriver but now that I’m testing the whole application (with a kafka broker), it seems multiple instances of the processor are instantiated with two of them processing the records. There are only two possible keys in this test, so I was expecting each processor instance to handle one of them for both inputs (topics). Instead, I observed that each processor instance processed one input entirely regardless of the keys.

Follow-up question

How can one implement a join node or any node with multiple inputs, if the answer to my first question is no?

I now believe the origin of my problem was a different number of partitions between the two topics in the second test (leading to broken copartition). This post was useful:

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.