mjsax commented on code in PR #18881:
URL: https://github.com/apache/kafka/pull/18881#discussion_r1956753925
##########
streams/src/main/java/org/apache/kafka/streams/kstream/BranchedKStream.java:
##########
@@ -16,54 +16,58 @@
*/
package org.apache.kafka.streams.kstream;
+import org.apache.kafka.streams.processor.api.Record;
+
import java.util.Map;
/**
- * Branches the records in the original stream based on the predicates
supplied for the branch definitions.
- * <p>
- * Branches are defined with {@link BranchedKStream#branch(Predicate,
Branched)} or
- * {@link BranchedKStream#defaultBranch(Branched)} methods. Each record is
evaluated against the {@code predicate}
- * supplied via {@link Branched} parameters, and is routed to the first branch
for which its respective predicate
- * evaluates to {@code true}. If a record does not match any predicates, it
will be routed to the default branch,
- * or dropped if no default branch is created.
- * <p>
- * Each branch (which is a {@link KStream} instance) then can be processed
either by
- * a {@link java.util.function.Function} or a {@link
java.util.function.Consumer} provided via a {@link Branched}
- * parameter. If certain conditions are met, it also can be accessed from the
{@link Map} returned by an optional
- * {@link BranchedKStream#defaultBranch(Branched)} or {@link
BranchedKStream#noDefaultBranch()} method call
- * (see <a href="#examples">usage examples</a>).
- * <p>
- * The branching happens on a first-match basis: A record in the original
stream is assigned to the corresponding result
- * stream for the first predicate that evaluates to {@code true}, and is
assigned to this stream only. If you need
- * to route a record to multiple streams, you can apply multiple {@link
KStream#filter(Predicate)} operators
- * to the same {@link KStream} instance, one for each predicate, instead of
branching.
- * <p>
+ * {@code BranchedKStream} is an abstraction of a <em>branched</em> record
stream of {@link Record key-value} pairs.
+ * It is an intermediate representation of a {@link KStream} in order to split
the original {@link KStream} into
+ * multiple {@link KStream sub-streams} (called branches).
* The process of routing the records to different branches is a stateless
record-by-record operation.
*
- * <h2><a name="maprules">Rules of forming the resulting map</a></h2>
- * The keys of the {@code Map<String, KStream<K, V>>} entries returned by
{@link BranchedKStream#defaultBranch(Branched)} or
- * {@link BranchedKStream#noDefaultBranch()} are defined by the following
rules:
+ * <p>Branches are defined via {@link #branch(Predicate, Branched)} or {@link
#defaultBranch(Branched)} methods.
+ * Each input record is evaluated against the {@code predicate} supplied via
{@link Branched} parameters, and is routed
+ * to the <em>first</em> branch for which its respective predicate evaluates
to {@code true}, and is included in this
+ * branch only.
+ * If a record does not match any predicates, it will be routed to the default
branch, or dropped if no default branch
+ * is created.
+ * For details about multicasting/broadcasting records into more than one
{@link KStream}, see {@link KStream#split()}.
+ *
+ * <p>Each {@link KStream branch} can be processed either by a {@link
java.util.function.Function Function} or a
+ * {@link java.util.function.Consumer Consumer} provided via a {@link
Branched} parameter.
+ * If certain conditions are met (see below), all created branches can be
accessed from the {@link Map} returned by an
+ * optional {@link #defaultBranch(Branched)} or {@link #noDefaultBranch()}
method call.
+ *
+ * <h6><a name="maprules">Rules of forming the resulting {@link Map}</a></h6>
Review Comment:
```suggestion
* <h6>Rules of forming the resulting {@link Map}</h6>
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]