Skip to content

EventHubQueueCache Methods

EventHub queue cache

Add(List<EventData>, DateTime)

View source
public List<StreamPosition> Add(List<EventData> messages, DateTime dequeueTimeUtc)
Add a list of EventHub EventData to the cache.

Parameters

messagesList<EventData>
The Event Hub messages to cache.
dequeueTimeUtcDateTime
The UTC time when the messages were dequeued.

Returns

The stream positions of the cached messages.

Dispose

View source
public void Dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

GetCursor(StreamId, StreamSequenceToken?)

View source
[System.Obsolete(Use TryGetCursor instead.)]
public object GetCursor(StreamId streamId, StreamSequenceToken? sequenceToken)
Get a cursor into the cache to read events from a stream.

Parameters

streamIdStreamId
The stream identifier.
sequenceTokenStreamSequenceToken?
The position from which to begin reading.

Returns

A cache cursor.

GetMaxAddCount

View source
public int GetMaxAddCount()
The limit of the maximum number of items that can be added

Returns

The maximum number of items which can currently be added.

Refresh(object, StreamSequenceToken?)

View source
public void Refresh(object cursor, StreamSequenceToken? sequenceToken)
Refreshes an inactive cursor at the provided sequence token.

Parameters

cursorobject
The cursor to refresh.
sequenceTokenStreamSequenceToken?
The sequence token to position the cursor at.

SignalPurge

View source
public void SignalPurge()
Send purge signal to the cache, the cache will perform a time based purge on its cached messages

TryGetCursor(StreamId, StreamSequenceToken?)

View source
public QueueCacheCursorResult<object> TryGetCursor(StreamId streamId, StreamSequenceToken? sequenceToken)
Attempts to get a cursor into the cache to read events from a stream.

Parameters

streamIdStreamId
The stream identifier.
sequenceTokenStreamSequenceToken?
The position from which to begin reading.

Returns

A successful result containing the acquired cursor, or a cache-miss result containing the unavailable position and current cache bounds.

TryGetCursorAtPosition(StreamId, StreamSubscriptionStartPosition)

View source
public QueueCacheCursorResult<object> TryGetCursorAtPosition(StreamId streamId, StreamSubscriptionStartPosition startPosition)
Attempts to get a cursor into the cache at the specified subscription start position.

Parameters

streamIdStreamId
The stream identifier.
startPositionStreamSubscriptionStartPosition
The initial subscription position.

Returns

A successful result containing the acquired cursor, a cache-miss result containing the unavailable position and current cache bounds, or QueueCacheCursorResultKind.

Exceptions

System.ArgumentOutOfRangeException
startPosition is not defined.

TryGetNextMessage(object, IBatchContainer?)

View source
[System.Obsolete(Use TryGetNextMessageWithResult instead.)]
public bool TryGetNextMessage(object cursorObj, out IBatchContainer? message)
Try to get the next message in the cache for the provided cursor.

Parameters

cursorObjobject
The cache cursor.
messageIBatchContainer?
The next message when one is available.

Returns

true when a message was returned; otherwise, false.

TryGetNextMessageWithResult(object, IBatchContainer?)

View source
public QueueCacheCursorMoveResult TryGetNextMessageWithResult(object cursorObj, out IBatchContainer? message)
Attempts to get the next message in the cache for the provided cursor.

Parameters

cursorObjobject
The cache cursor.
messageIBatchContainer?
The next message when one is available.

Returns

A successful result with a non-null message, QueueCacheCursorMoveResultKind with a null message, or a cache-miss result with a null message.