title: Kafka Streams DSL: Aggregating a KStream to a GlobalKTable
body: <p>I have an input stream:</p>
  
  <p><code>KStream&lt;String, X&gt; inputStream = ...</code></p>
  
  <p>That I would like to operate on (filter then aggregate) in such a way that I output into a <code>GlobalKTable&lt;String, Y&gt;</code> which I can then read back in using:</p>
  
  <p><code>KeyValueIterator&lt;String, Y&gt; = streams.store("y-global-store", QueryableStoreTypes.keyValueStore()).all()</code></p>
  
  <p>Can the Streams DSL support this? It seems it would be possible if the output table was a <code>KTable</code>, but given the small amount of data I will have in this store I'd like to use a <code>GlobalKTable</code></p>
  
  <hr>
  
  <p>Here is my processor which converts a <code>KStream&lt;String, X&gt;</code> to a <code>KTable&lt;String, Y&gt;</code></p>
  
  <pre><code>KTable&lt;String, Y&gt; outputTable = inputStream
      .filter(...)
      .groupByKey(Grouped.with(Serdes.String(), ySerde))
      .aggregate(
          initializeWithNull(),
          aggregateXToAY(),
          Materialized.`as`&lt;String, Y, KeyValueStore&lt;Bytes, ByteArray&gt;&gt;("y-global-store")
              .withKeySerde(stringSerde)
              .withValueSerde(tagRecordSerde)
      )
  </code></pre>
  
  <p>However this doesn't create a <code>GlobalKTable</code>, what am I missing?</p>