How does the state full operations work in Kafka Stream application with multiple instances? Let's just say that we have 2 topics with 2 partitions each A and B. We have a stream application which consumes from both the topics and there's a join between the 2 streams.
Now we are running 2 instances of this stream application. As far as I understand, each instance will be assigned one of the 2 partitions of each topic.
Now how will the join take place if the messages to be joined are consumed by different instances of the application? I can't get my head around it.
Although I tested it for a small stream application which does seem to be working correctly. Can I always increase the number of instances of any kind of application without ever thinking about the kind of topology defined in the stream application?
Is there any document that I can go through to understand the details of its working?