Combine this splitter with a "joiner" which obtains a consumer (generalized as
a HandlerFactory
for its substreams based on a Context value.
Combine this splitter with a "joiner" which obtains a consumer (generalized as
a HandlerFactory
for its substreams based on a Context value.
If the consumer logic is independent of any Context value, you can pass
a HandlerFactory directly instead of wrapping it as a function, since
HandlerFactory
extends Any => HandlerFactory
.
The result type returned by the consumer logic
The consumer logic for substreams generated by this Splitter
A Transformer that feeds inputs through this splitter to create
substreams, then feeds those substreams into the joiner
to create
Out
values that will be passed downstream.
(splitter: StringAdd).self
(splitter: StringFormat).self
(Since version 0.6) Use .map instead
(splitter: ArrowAssoc[Splitter[In, Context]]).x
(Since version 2.10.0) Use leftOfArrow
instead
(splitter: Ensuring[Splitter[In, Context]]).x
(Since version 2.10.0) Use resultOfEnsuring
instead
A stream transformation which divides a stream of
In
events into substreams, where each substream is associated with aContext
value.A splitter must be combined with a Consumer via the
through
method. The consumer will be run on each of the substreams created by this splitter, generating a single value for each substream. The combination of a Splitter and a Consumer/Parser yields aTransformer
.For example, given a stream of symbols like
an example Splitter might use
[
and]
as signals that a context is starting or ending, respectively. So the substreams identified by that splitter would be[ 1 2 3 ]
[ 4 5 6 ]
The example splitter would need to be combined with a Consumer/Parser that understands those substreams individually. For example, a Consumer that calculates the sum of the numbers between the
[
and]
would generate the following results for each respective substream:6
15
Thus the combination of the example splitter and the summing consumer would yield a transformer that turns the stream
A A [ 1 2 3 ] B C [ 4 5 6 ]
into the stream6 15
. That transformer will need to be attached to some downstream handler to produce a meaningful value from the transformed stream, e.g. aConsumer.toList
could consume the6 15
stream as aList(6, 15)
.