Skip to content

EventHubAdapterFactory Methods

Queue adapter factory which allows the PersistentStreamProvider to use EventHub as its backend persistent event queue.

Create(IServiceProvider, string)

static
View source
public static EventHubAdapterFactory Create(IServiceProvider services, string name)
Creates and initializes an Event Hubs adapter factory.

Parameters

servicesIServiceProvider
The service provider.
namestring
The stream provider name.

Returns

The initialized adapter factory.

CreateAdapter

View source
public Task<IQueueAdapter> CreateAdapter()
Creates the queue adapter and initializes its partition mapping.

Returns

The queue adapter.

CreateCacheFactory(EventHubStreamCachePressureOptions)

virtual
View source
protected virtual IEventHubQueueCacheFactory CreateCacheFactory(EventHubStreamCachePressureOptions eventHubCacheOptions)
Create a IEventHubQueueCacheFactory. It will create a EventHubQueueCacheFactory by default. User can override this function to return their own implementation of IEventHubQueueCacheFactory, and other customization of IEventHubQueueCacheFactory if they may.

Parameters

eventHubCacheOptionsEventHubStreamCachePressureOptions
The cache pressure options.

Returns

The Event Hub queue cache factory.

CreateQueueCache(QueueId)

View source
public IQueueCache CreateQueueCache(QueueId queueId)
Creates a cache for the specified queue.

Parameters

queueIdQueueId
The queue identifier.

Returns

The queue cache.

CreateReceiver(QueueId)

View source
public IQueueAdapterReceiver CreateReceiver(QueueId queueId)
Creates a queue receiver for the specified queue.

Parameters

queueIdQueueId
The queue identifier.

Returns

The queue receiver.

GetDeliveryFailureHandler(QueueId)

View source
public Task<IStreamFailureHandler> GetDeliveryFailureHandler(QueueId queueId)
Gets the delivery failure handler for a queue.

Parameters

queueIdQueueId
The queue identifier.

Returns

A task which resolves to the delivery failure handler.

GetPartitionIdsAsync

virtual
View source
protected virtual Task<string[]> GetPartitionIdsAsync()
Gets the partition identifiers from Event Hubs.

Returns

A task which resolves to the partition identifiers.

GetQueueAdapterCache

View source
public IQueueAdapterCache GetQueueAdapterCache()
Gets the queue cache factory implemented by this instance.

Returns

The queue cache factory.

GetStreamQueueMapper

View source
public IStreamQueueMapper GetStreamQueueMapper()
Gets the mapper between Orleans stream queues and Event Hub partitions.

Returns

The stream queue mapper.

Init

virtual
View source
public virtual void Init()
Initializes the adapter factory and its Event Hub client, cache, queue mapping, and monitoring components.

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

virtual
View source
public virtual Task QueueMessageBatchAsync<T>(StreamId streamId, IEnumerable<T> events, StreamSequenceToken? token, Dictionary<string, object>? requestContext)
Writes a set of events to the queue as a single batch associated with the provided streamId.

Parameters

streamIdStreamId
The destination stream.
eventsIEnumerable<T>
The events to enqueue.
tokenStreamSequenceToken?
The stream sequence token, which must be null for Event Hubs streams.
requestContextDictionary<string, object>
The request context to propagate with the events.

Returns

A task which represents the enqueue operation.