Class AggregateEventStream<T>
java.lang.Object
io.fluxzero.sdk.persisting.eventsourcing.AggregateEventStream<T>
- Type Parameters:
T- The type of event elements in the stream.
- All Implemented Interfaces:
AutoCloseable, BaseStream<T, Stream<T>>, Stream<T>
A wrapper around a stream of aggregate events, enriched with metadata such as the aggregate ID and the last known
sequence number.
This type is returned by EventStore.getEvents(Object)
and provides access to the raw or deserialized event stream, along with information necessary for event-sourced state
reconstruction (like the latest known sequence number).
-
Nested Class Summary
Nested classes/interfaces inherited from interface Stream
Stream.Builder<T> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanbooleanvoidclose()<R> Rcollect(Supplier<R> supplier, BiConsumer<R, ? super T> accumulator, BiConsumer<R, R> combiner) <R,A> R <O> AggregateEventStream<O> Transforms the underlying stream of events using a given stream converter function.longcount()distinct()findAny()<R> Stream<R> flatMapToDouble(Function<? super T, ? extends DoubleStream> mapper) flatMapToInt(Function<? super T, ? extends IntStream> mapper) flatMapToLong(Function<? super T, ? extends LongStream> mapper) voidvoidforEachOrdered(Consumer<? super T> action) Returns the last known sequence number from the event stream, if available.booleaniterator()limit(long maxSize) <R> Stream<R> <R> Stream<R> mapMulti(BiConsumer<? super T, ? super Consumer<R>> mapper) mapMultiToDouble(BiConsumer<? super T, ? super DoubleConsumer> mapper) mapMultiToInt(BiConsumer<? super T, ? super IntConsumer> mapper) mapMultiToLong(BiConsumer<? super T, ? super LongConsumer> mapper) mapToDouble(ToDoubleFunction<? super T> mapper) mapToInt(ToIntFunction<? super T> mapper) mapToLong(ToLongFunction<? super T> mapper) max(Comparator<? super T> comparator) min(Comparator<? super T> comparator) booleanparallel()reduce(BinaryOperator<T> accumulator) reduce(T identity, BinaryOperator<T> accumulator) <U> Ureduce(U identity, BiFunction<U, ? super T, U> accumulator, BinaryOperator<U> combiner) skip(long n) sorted()sorted(Comparator<? super T> comparator) Object[]toArray()<A> A[]toArray(IntFunction<A[]> generator) toList()
-
Constructor Details
-
AggregateEventStream
public AggregateEventStream()
-
-
Method Details
-
convert
Transforms the underlying stream of events using a given stream converter function. The returned instance retains the same aggregate ID and sequence number metadata.- Type Parameters:
O- The output type of the converted stream.- Parameters:
streamConverter- A function that converts the original stream to another stream type.- Returns:
- A new
AggregateEventStreamwrapping the converted stream.
-
getLastSequenceNumber
-
iterator
-
filter
-
map
-
mapToInt
-
mapToLong
-
mapToDouble
- Specified by:
mapToDoublein interfaceStream<T>
-
flatMap
-
flatMapToInt
-
flatMapToLong
- Specified by:
flatMapToLongin interfaceStream<T>
-
flatMapToDouble
- Specified by:
flatMapToDoublein interfaceStream<T>
-
mapMulti
-
mapMultiToInt
- Specified by:
mapMultiToIntin interfaceStream<T>
-
mapMultiToLong
- Specified by:
mapMultiToLongin interfaceStream<T>
-
mapMultiToDouble
- Specified by:
mapMultiToDoublein interfaceStream<T>
-
distinct
-
sorted
-
sorted
-
peek
-
limit
-
skip
-
takeWhile
-
dropWhile
-
forEach
-
forEachOrdered
- Specified by:
forEachOrderedin interfaceStream<T>
-
toArray
-
toArray
-
reduce
-
reduce
-
reduce
public <U> U reduce(U identity, BiFunction<U, ? super T, U> accumulator, BinaryOperator<U> combiner) -
collect
public <R> R collect(Supplier<R> supplier, BiConsumer<R, ? super T> accumulator, BiConsumer<R, R> combiner) -
collect
-
toList
-
min
-
max
-
count
-
anyMatch
-
allMatch
-
noneMatch
-
findFirst
-
findAny
-
spliterator
- Specified by:
spliteratorin interfaceBaseStream<T, Stream<T>>
-
isParallel
public boolean isParallel()- Specified by:
isParallelin interfaceBaseStream<T, Stream<T>>
-
sequential
- Specified by:
sequentialin interfaceBaseStream<T, Stream<T>>
-
parallel
-
unordered
-
onClose
-
close
public void close()- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceBaseStream<T, Stream<T>>
-