readStream method

  1. @override
Stream<StreamEvent> readStream(
  1. StreamName name,
  2. StreamReadPosition start, [
  3. 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);
  }
}