readStream method
Stream<StreamEvent>
readStream(
- StreamName name,
- StreamReadPosition start, [
- int count = Max
override
Read events asynchronously as a Stream.
Parameter name
identifies stream to read from.
Use parameter start
to define the position
in the stream to start reading from. Use count
to limit number of events that is read from
the stream (default is Max which returns all
events from start
).
Implementation
@override
Stream<StreamEvent> readStream(
StreamName name,
StreamReadPosition start, [
int count = Max,
]) async* {
try {
final read = await client.subscribe(
name.value,
position: start.asStreamPosition(),
);
yield* read.stream.asyncMap(_toStreamEvent);
} on StreamNotFoundException {
throw $e.StreamNotFoundException(name);
}
}