title: What, exactly happens when a repartition occurs in a kafka stream?
body: <p>Say I have a stream of employees, keyed by <code>empId</code>, which also includes <code>departmentId</code>.
  I want to aggregate by department.  So I do a <code>selectKey(</code><em>mapper to get departmentId</em><code>)</code>, then <code>groupByKey()</code> (or I could just do a a <code>groupBy(...)</code>, I assume), and then, say, count().  What exactly happens?  I gather that it does a "repartition". I <em>think</em> what happens is that it writes to an "internal" topic, which I is just a regular topic with a derived name, created automatically. That is, shared by all instances of the stream, not just one (i.e. not local). So the aggregation is across all of the new key, not just those messages from the source stream instance (I think).  Is that correct?</p>
  
  <p>I've not found a comprehensive description of repartitioning. Can anybody point me to a good article on this?</p>