You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@kafka.apache.org by Shimi Kiviti <sh...@gmail.com> on 2017/03/05 19:01:36 UTC

Kafka streams DSL advantage

Hi Eveyone,

I have seen a few times (here in the mailing list )were someone wanted to
use kafka streams DSL for something that wasn't possible to do with the DSL
and the suggestion was to use the processor API.

I was wondering, except the fluent functional code of the DSL, are there
any other benefits of using the DSL over the processor API?

thanks,
Shimi

Re: Kafka streams DSL advantage

Posted by Michael Noll <mi...@confluent.io>.
The DSL has some unique features that aren't in the Processor API, such as:

- KStream and KTable abstractions.
- Support for time windows (tumbling windows, hopping windows) and session
windows.  The Processor API only has stream-time based `punctuate()`.
- Record caching, which is slightly better than state store caching for the
Processor API (
http://docs.confluent.io/current/streams/developer-guide.html#memory-management
)

You can re-implement most of these features in the processor API too (after
all, the DSL itself is based on the Processor API), but that's manual DIY
work.

That being said, you can also combine the DSL and the Processor API via the
DSL's `process()` and `transform` / `transformValues` operations.  See [1]
for an example.

Best,
Michael



[1]
https://github.com/confluentinc/examples/blob/3.2.x/kafka-streams/src/test/java/io/confluent/examples/streams/MixAndMatchLambdaIntegrationTest.java





On Sun, Mar 5, 2017 at 8:01 PM, Shimi Kiviti <sh...@gmail.com> wrote:

> Hi Eveyone,
>
> I have seen a few times (here in the mailing list )were someone wanted to
> use kafka streams DSL for something that wasn't possible to do with the DSL
> and the suggestion was to use the processor API.
>
> I was wondering, except the fluent functional code of the DSL, are there
> any other benefits of using the DSL over the processor API?
>
> thanks,
> Shimi
>