+2 votes
in Apache Storm by
Can a Trident topology have Multiple Streams?

1 Answer

0 votes
by
Can a Trident Topology work like a workflow with conditional paths (if-else)? e.g. A Spout (S1) connects to a bolt (B0) which based on certain values in the incoming tuple routes them to either bolt (B1) or bolt (B2) but not both.

A Trident “each” operator returns a Stream object, which you can store in a variable. You can then run multiple eaches on the same Stream to split it, e.g.:

Stream s = topology.each(…).groupBy(…).aggregate(…)

Stream branch1 = s.each(…, FilterA)

Stream branch2 = s.each(…, FilterB)

You can join streams with join, merge or multiReduce.

Related questions

+2 votes
asked Jul 3, 2021 in Apache Storm by rajeshsharma
0 votes
asked Jul 6, 2023 in Snowflake by SakshiSharma
...