Skip to content

EventHubDataAdapter Methods

Default event hub data adapter. Users may subclass to override event data to stream mapping.

EncodeMessageIntoSegment(EventData, Func<int, ArraySegment<byte>>)

virtual
View source
protected virtual ArraySegment<byte> EncodeMessageIntoSegment(EventData queueMessage, Func<int, ArraySegment<byte>> getSegment)
Encodes an Event Hub message into a cache segment.

Parameters

queueMessageEventData
The Event Hub message.
getSegmentFunc<int, ArraySegment<byte>>
The delegate used to allocate a cache segment of the required size.

Returns

The segment containing the encoded message.

FromQueueMessage(StreamPosition, EventData, DateTime, Func<int, ArraySegment<byte>>)

virtual
View source
public virtual CachedMessage FromQueueMessage(StreamPosition streamPosition, EventData queueMessage, DateTime dequeueTime, Func<int, ArraySegment<byte>> getSegment)
Converts an Event Hub message into a cached message.

Parameters

streamPositionStreamPosition
The stream position of the message.
queueMessageEventData
The Event Hub message.
dequeueTimeDateTime
The UTC time when the message was dequeued.
getSegmentFunc<int, ArraySegment<byte>>
The delegate used to allocate a cache segment of the required size.

Returns

The cached message.

GetBatchContainer(EventHubMessage)

virtual
View source
protected virtual IBatchContainer GetBatchContainer(EventHubMessage eventHubMessage)
Convert an EventHubMessage to a batch container

Parameters

eventHubMessageEventHubMessage
The Event Hub message.

Returns

The batch container.

GetBatchContainer(CachedMessage)

virtual
View source
public virtual IBatchContainer GetBatchContainer(ref CachedMessage cachedMessage)
Converts a cached message to a batch container for delivery

Parameters

cachedMessageCachedMessage
The cached message.

Returns

The batch container.

GetOffset(CachedMessage)

virtual
View source
public virtual string GetOffset(CachedMessage lastItemPurged)
Get offset from cached message. Left to derived class, as only it knows how to get this from the cached message.

Parameters

lastItemPurgedCachedMessage
The cached message.

Returns

The Event Hub offset.

GetPartitionKey(StreamId)

virtual
View source
public virtual string GetPartitionKey(StreamId streamId)
Get the Event Hub partition key to use for a stream.

Parameters

streamIdStreamId
The stream Guid.

Returns

The partition key to use for the stream.

GetSequenceToken(CachedMessage)

virtual
View source
public virtual StreamSequenceToken GetSequenceToken(ref CachedMessage cachedMessage)
Gets the stream sequence token from a cached message.

Parameters

cachedMessageCachedMessage
The cached message.

Returns

The stream sequence token.

GetStreamPosition(string, EventData)

virtual
View source
public virtual StreamPosition GetStreamPosition(string partition, EventData queueMessage)
Gets the stream position represented by an Event Hub message.

Parameters

partitionstring
The Event Hub partition identifier.
queueMessageEventData
The Event Hub message.

Returns

The stream position.

ToQueueMessage(StreamId, IEnumerable<T>, StreamSequenceToken?, Dictionary<string, object>)

virtual
View source
public virtual EventData ToQueueMessage<T>(StreamId streamId, IEnumerable<T> events, StreamSequenceToken? token, Dictionary<string, object>? requestContext)
Creates a cloud queue message from stream event data.

Parameters

streamIdStreamId
The stream identifier.
eventsIEnumerable<T>
The events.
tokenStreamSequenceToken?
The token.
requestContextDictionary<string, object>
The request context.

Returns

A new queue message.