0
votes

I have a source topic with 2 partitions and I'm starting 2 kafka streams application with same application.id but different sink topics.

1) Will the 2 application instances receive data from different partitions?

2) If one of the applications is killed, will the other instance automatically consume from both the instances?

3) How can I prove the above scenario?

2
Just look into the logs. Kafka Streams logs partition and task assignments.Matthias J. Sax

2 Answers

1
votes

Kafka Streams is using the same consumer library, so behavior should match to what you described - if you have 2 applications, then each will consume from partitions assigned to it, and if one is killed, then the alive will process data from all partitions...

Prove is possible by running applications, for example - in simplest case, just print different prefixes for consumed data, and submit keyed values so you can distinguish when one message is going to one partition from what is sent to another...

0
votes

1) Will the 2 application instances receive data from different partitions?

Yes.

2) If one of the applications is killed, will the other instance automatically consume from both the instances?

Yes. (But keep in mind that the other instance may now send the output data to its own, rather than the original instance's output topics.)

3) How can I prove the above scenario?

You can inspect the logs of your application (Kafka Streams will log information about topics/partitions/stream tasks for each instances), you can run integration tests, etc.