# JournalStorageConsumerExtensions.ReadAsync(IJournalStorageConsumer, Stream, IJournalMetadata?, bool, CancellationToken)

[Type overview](/orleans/docs/api/csharp/microsoft.orleans.durable/orleans.durable.journaling.journalstorageconsumerextensions/) | [Methods](/orleans/docs/api/csharp/microsoft.orleans.durable/orleans.durable.journaling.journalstorageconsumerextensions/methods/)

[Source](https://github.com/dotnet/orleans/blob/6a0e937f544c35ffcf11b37e4c2b7de5a1580a03/src/Orleans.Durable/Journaling/JournalStorageConsumerExtensions.cs)

```csharp
public static ValueTask<long> ReadAsync(this IJournalStorageConsumer consumer, Stream input, IJournalMetadata? metadata, bool complete, CancellationToken cancellationToken)
```

Reads all bytes from `input` and incrementally supplies them to `consumer`.

### Parameters

- `consumer` (`IJournalStorageConsumer`): The journal storage consumer.
- `input` (`Stream`): The stream to read from.
- `metadata` (`IJournalMetadata?`): The metadata associated with the journal data being read, or `null` if no metadata is available.
- `complete` (`bool`): Whether to notify the consumer that no more data will be supplied. If `false`, the consumer must read all supplied bytes.
- `cancellationToken` (`CancellationToken`): The cancellation token.

### Returns

The number of bytes read from `input`.
