What is the difference between Kafka Streams DSL t

2019-08-07 12:21发布

问题:

from what i read from here : https://docs.confluent.io/3.0.0/streams/developer-guide.html#streams-developer-guide-processor-api

The difference to my understanding is that i can be more specific in the Processor API as to what record serializer enters the stream (source) to what exits the stream (sink) and in the stream DSL it must be the same.

is it possible to create a Kstream with KStreamBuilder and with TopologyBuilder that will result in the exact same stream? if so can i see an example?

回答1:

... and in the stream DSL it must be the same.

I don't think that is right. You can take messages from an input stream, change the value or even the key, and put them on a different output stream.

final KStream<String, String> inputStream = builder.stream("inputStream");
...
inputStream
    .filter(this::acceptCertainMessages)
    .transform(new MyTransformerSupplier<String, String>("store"), "store")
    .to("outputStream");