# PooledQueueCache.TryGetNextMessageWithResult(object, IBatchContainer?)

[Type overview](/orleans/docs/api/csharp/microsoft.orleans.streaming/orleans.providers.streams.common.pooledqueuecache/) | [Methods](/orleans/docs/api/csharp/microsoft.orleans.streaming/orleans.providers.streams.common.pooledqueuecache/methods/)

[Source](https://github.com/dotnet/orleans/blob/1644940b035c7bdf215a4fd7135757c06bcfe9ec/src/Orleans.Streaming/Common/PooledCache/PooledQueueCache.cs#L504-L615)

```csharp
public QueueCacheCursorMoveResult TryGetNextMessageWithResult(object cursorObj, out IBatchContainer? message)
```

Attempts to acquire the next message in the cache at the provided cursor.

### Parameters

- `cursorObj` (`object`): The cache cursor.
- `message` (`IBatchContainer?`): The next message when one is available.

### Returns

A successful result with a non-null `message`, [QueueCacheCursorMoveResultKind](/orleans/docs/api/csharp/microsoft.orleans.streaming/orleans.streams.queuecachecursormoveresultkind/) with a null message, or a cache-miss result with a null message.

### Exceptions

- `System.ArgumentNullException`: `cursorObj` is `null`.
- `System.ArgumentOutOfRangeException`: `cursorObj` is not a cache cursor.
