# JournalStorageConsumerExtensions Methods

[Type overview](/orleans/docs/api/csharp/microsoft.orleans.journaling/orleans.journaling.journalstorageconsumerextensions/)

## Complete(IJournalStorageConsumer, IJournalMetadata?) {#complete-this-orleans-journaling-ijournalstorageconsumer-orleans-journaling-ijou-a28320ce}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.journaling/orleans.journaling.journalstorageconsumerextensions/methods/complete-this-orleans-journaling-ijournalstorageconsumer-orleans-journaling-ijou-a28320ce/)

[Source](https://github.com/dotnet/orleans/blob/e4e752cedecc2976811db49802c7a999b1f1c704/src/Orleans.Journaling/JournalStorageConsumerExtensions.cs#L18-L23)

```csharp
public static void Complete(this IJournalStorageConsumer consumer, IJournalMetadata? metadata)
```

Notifies `consumer` that no more data will be supplied.

### Parameters

- `consumer` (`IJournalStorageConsumer`): The journal storage consumer.
- `metadata` (`IJournalMetadata?`): The metadata associated with the journal data being read, or `null` if no metadata is available.

## Read(IJournalStorageConsumer, IEnumerable&lt;ReadOnlyMemory&lt;byte&gt;&gt;, IJournalMetadata?, bool) {#read-this-orleans-journaling-ijournalstorageconsumer-system-collections-generic-66ee46a8}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.journaling/orleans.journaling.journalstorageconsumerextensions/methods/read-this-orleans-journaling-ijournalstorageconsumer-system-collections-generic-66ee46a8/)

[Source](https://github.com/dotnet/orleans/blob/e4e752cedecc2976811db49802c7a999b1f1c704/src/Orleans.Journaling/JournalStorageConsumerExtensions.cs#L83-L100)

```csharp
public static void Read(this IJournalStorageConsumer consumer, IEnumerable<ReadOnlyMemory<byte>> segments, IJournalMetadata? metadata, bool complete)
```

Supplies ordered `segments` to `consumer`.

### Parameters

- `consumer` (`IJournalStorageConsumer`): The journal storage consumer.
- `segments` (`IEnumerable<ReadOnlyMemory<byte>>`): The ordered bytes to read.
- `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.

## Read(IJournalStorageConsumer, ReadOnlyMemory&lt;byte&gt;, IJournalMetadata?, bool) {#read-this-orleans-journaling-ijournalstorageconsumer-system-readonlymemory-byte-6760c933}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.journaling/orleans.journaling.journalstorageconsumerextensions/methods/read-this-orleans-journaling-ijournalstorageconsumer-system-readonlymemory-byte-6760c933/)

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

```csharp
public static void Read(this IJournalStorageConsumer consumer, ReadOnlyMemory<byte> input, IJournalMetadata? metadata, bool complete)
```

Supplies `input` to `consumer`.

### Parameters

- `consumer` (`IJournalStorageConsumer`): The journal storage consumer.
- `input` (`ReadOnlyMemory<byte>`): The bytes to read.
- `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.

## Read(IJournalStorageConsumer, ReadOnlySequence&lt;byte&gt;, IJournalMetadata?, bool) {#read-this-orleans-journaling-ijournalstorageconsumer-system-buffers-readonlysequ-81324265}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.journaling/orleans.journaling.journalstorageconsumerextensions/methods/read-this-orleans-journaling-ijournalstorageconsumer-system-buffers-readonlysequ-81324265/)

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

```csharp
public static void Read(this IJournalStorageConsumer consumer, ReadOnlySequence<byte> input, IJournalMetadata? metadata, bool complete)
```

Supplies `input` to `consumer`.

### Parameters

- `consumer` (`IJournalStorageConsumer`): The journal storage consumer.
- `input` (`ReadOnlySequence<byte>`): The bytes to read.
- `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.

## ReadAsync(IJournalStorageConsumer, Stream, IJournalMetadata?, CancellationToken) {#readasync-this-orleans-journaling-ijournalstorageconsumer-system-io-stream-orlea-cfea81c1}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.journaling/orleans.journaling.journalstorageconsumerextensions/methods/readasync-this-orleans-journaling-ijournalstorageconsumer-system-io-stream-orlea-cfea81c1/)

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

```csharp
public static ValueTask<long> ReadAsync(this IJournalStorageConsumer consumer, Stream input, IJournalMetadata? metadata, 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.
- `cancellationToken` (`CancellationToken`): The cancellation token.

### Returns

The number of bytes read from `input`.

## ReadAsync(IJournalStorageConsumer, Stream, IJournalMetadata?, bool, CancellationToken) {#readasync-this-orleans-journaling-ijournalstorageconsumer-system-io-stream-orlea-58ef9386}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.journaling/orleans.journaling.journalstorageconsumerextensions/methods/readasync-this-orleans-journaling-ijournalstorageconsumer-system-io-stream-orlea-58ef9386/)

[Source](https://github.com/dotnet/orleans/blob/e4e752cedecc2976811db49802c7a999b1f1c704/src/Orleans.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`.
