Class AggregateEventStream<T>
java.lang.Object
io.fluxcapacitor.javaclient.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(java.lang.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 java.util.stream.Stream
Stream.Builder<T>
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
boolean
void
close()
<R> R
collect
(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.long
count()
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) void
void
forEachOrdered
(Consumer<? super T> action) Returns the last known sequence number from the event stream, if available.boolean
iterator()
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) boolean
parallel()
reduce
(BinaryOperator<T> accumulator) reduce
(T identity, BinaryOperator<T> accumulator) <U> U
reduce
(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
AggregateEventStream
wrapping the converted stream.
-
getLastSequenceNumber
Returns the last known sequence number from the event stream, if available.- Returns:
- An
Optional
containing the sequence number, or empty if not set.
-
iterator
- Specified by:
iterator
in interfaceBaseStream<T,
Stream<T>>
-
filter
-
map
-
mapToInt
-
mapToLong
-
mapToDouble
- Specified by:
mapToDouble
in interfaceStream<T>
-
flatMap
-
flatMapToInt
- Specified by:
flatMapToInt
in interfaceStream<T>
-
flatMapToLong
- Specified by:
flatMapToLong
in interfaceStream<T>
-
flatMapToDouble
- Specified by:
flatMapToDouble
in interfaceStream<T>
-
mapMulti
-
mapMultiToInt
- Specified by:
mapMultiToInt
in interfaceStream<T>
-
mapMultiToLong
- Specified by:
mapMultiToLong
in interfaceStream<T>
-
mapMultiToDouble
- Specified by:
mapMultiToDouble
in interfaceStream<T>
-
distinct
-
sorted
-
sorted
-
peek
-
limit
-
skip
-
takeWhile
-
dropWhile
-
forEach
-
forEachOrdered
- Specified by:
forEachOrdered
in interfaceStream<T>
-
toArray
-
toArray
-
reduce
-
reduce
-
reduce
-
collect
public <R> R collect(Supplier<R> supplier, BiConsumer<R, ? super T> accumulator, BiConsumer<R, R> combiner) -
collect
-
toList
-
min
-
max
-
count
public long count() -
anyMatch
-
allMatch
-
noneMatch
-
findFirst
-
findAny
-
spliterator
- Specified by:
spliterator
in interfaceBaseStream<T,
Stream<T>>
-
isParallel
public boolean isParallel()- Specified by:
isParallel
in interfaceBaseStream<T,
Stream<T>>
-
sequential
- Specified by:
sequential
in interfaceBaseStream<T,
Stream<T>>
-
parallel
- Specified by:
parallel
in interfaceBaseStream<T,
Stream<T>>
-
unordered
- Specified by:
unordered
in interfaceBaseStream<T,
Stream<T>>
-
onClose
- Specified by:
onClose
in interfaceBaseStream<T,
Stream<T>>
-
close
public void close()- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceBaseStream<T,
Stream<T>>
-