title: Kafka streams concurrency behavior
body: <p>If there is a shared variable in my kafka streams application and that is updated by multiple threads in the processing code, how is that handled? Do I have to make that shared-variable thread safe or is that some how handled by the Kafka streams library? Somewhere in the docs, I read that there is no need to co-ordinate between threads when running a Kafka streams app. For example, here is a pseudo code:</p>
  
  <pre><code>KStream&lt;byte[], byte[]&gt; input = ...;
  int counter = 0;
  
  KStream&lt;byte[], byte[]&gt;[] processed = input.map(
      (k, v) -&gt; {
        ....
        ....
        //update counter by multiple threads.
  );
  </code></pre>
  
  <p>What will happen to counter if this code is executed by multiple stream tasks from the same app instance? How about the variable "processed" as this can also be updated by multiple threads? This requires some kind of synchronization in normal Java scenario. I am curious if that is handled by the Kafka streams library. </p>
  
  <p>Thank you!</p>