[ 
https://issues.apache.org/jira/browse/KAFKA-7445?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16633103#comment-16633103
 ] 

Matthias J. Sax commented on KAFKA-7445:
----------------------------------------

I guess, you can write the following code to get what you need:
{noformat}
KStream stream = ...
KStream stream1 = stream.filter(...);
KStream stream2 = stream.filter(...);
KStream stream3 = stream.filter(...);{noformat}
This code applies each `Predicate` to all records. Reusing the same `KStream` 
variable (ie, `stream`) multiple times is a logical broadcast, ie, each record 
will be passed into each `filter()`.

It's up to you if you think it would be helpful to have a single operator for 
this. The question is, how this operator could be named?

> Branch one Stream in multiple Streams
> -------------------------------------
>
>                 Key: KAFKA-7445
>                 URL: https://issues.apache.org/jira/browse/KAFKA-7445
>             Project: Kafka
>          Issue Type: New Feature
>          Components: streams
>            Reporter: Dennis Reiter
>            Priority: Minor
>
> Hi,
> I need to branch/split KStreams in multiple independent KStreams. I thought, 
> {{org.apache.kafka.streams.kstream.internals.KStreamImpl#branch}} is the 
> right one but in fact, its designed for another purpose.
> In contrast to {{branch}} I need to assign the record to *all* matching 
> streams, not only one stream.
> Speaking in code 
> ({{org.apache.kafka.streams.kstream.internals.KStreamBranch}}):
> {code:java}
> if (predicates[i].test(key, value)) {
>    // use forward with childIndex here
>    // and pipe the record to multiple streams
>    context().forward(key, value, i);
> }
> {code}
> My question: is this still possible with features already included in 
> Streams? Or shall I propose a change?
> Thanks in advance
> Dennis



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to