If your data is already partitioned by key, you can save writing to a
topic by doing a dummy reduce instead:

stream
  .groupByKey()
  .reduce(new Reducer() {
    V apply(V value1, V value2) {
      return value2;
    }
  },
  "yourStoreName");

(replace V with your actuall value type)


-Matthias

On 1/24/17 8:53 AM, Damian Guy wrote:
> Hi Nick,
> 
> I guess there is some reason why you can't just build it as a table to
> begin with?
> There isn't a convenient method for doing this right now, but you could do
> something like:
> 
> stream.to("some-other-topic");
> builder.table("some-other-topic");
> 
> Thanks,
> Damian
> 
> On Tue, 24 Jan 2017 at 16:32 Nick DeCoursin <n.decour...@foodpanda.com>
> wrote:
> 
>> Hello,
>>
>> How can I simply table a Kafka Stream? I have a Kafka Stream, and I want to
>> create a table from it backed by a state store. The key of the stream could
>> be the same as the table.
>>
>> I've tried following examples, but it seems all examples use `groupBy` or
>> `count` to convert `KStream`s into `KTable`s. Is there any other way?
>>
>> Thank you very much,
>> Nick DeCoursin
>>
>> --
>>
>> Nick DeCoursin
>> Software Engineer
>> foodpanda
>>
>> Tel | +1 920 450 5434 <(920)%20450-5434>
>>
>> Mail | n.decour...@foodpanda.com
>>
>> Skype | nick.foodpanda
>>
>> Foodpanda GmbH | Schreiberhauer Str. 30 | 10317 Berlin | Germany
>> Sitz der Gesellschaft | Berlin, AG Charlottenburg | HRB 138224 B |
>> USt-ID-Nr | DE 283789080
>> Geschäftsführer | Benjamin Bauer, Felix Plog, Ralf Wenzel
>>
>> CONFIDENTIALITY NOTICE: This message (including any attachments) is
>> confidential and may be privileged. It may be read, copied and used only by
>> the intended recipient. If you have received it in error please contact the
>> sender (by return e-mail) immediately and delete this message. Any
>> unauthorized use or dissemination of this message in whole or in parts is
>> strictly prohibited.
>>
> 

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to