Table of Contents

Interface ILongPollingStrategy

Namespace
Excalibur.Dispatch.Transport
Assembly
Excalibur.Dispatch.Transport.Abstractions.dll

Defines the contract for long polling strategies that adapt wait times based on message patterns.

public interface ILongPollingStrategy
Extension Methods

Properties

Name

Gets the strategy name.

string Name { get; }

Property Value

string

The strategy name.

Methods

CalculateOptimalWaitTimeAsync()

Calculates the optimal wait time based on current message flow patterns.

ValueTask<TimeSpan> CalculateOptimalWaitTimeAsync()

Returns

ValueTask<TimeSpan>

The recommended wait time for the next receive operation.

GetCurrentLoadFactorAsync()

Gets the current load factor (0.0 to 1.0) based on recent message patterns.

ValueTask<double> GetCurrentLoadFactorAsync()

Returns

ValueTask<double>

The current load factor where 1.0 represents maximum load.

PollAsync<TMessage>(string, CancellationToken)

Executes the polling strategy.

Task<List<TMessage>> PollAsync<TMessage>(string queueUrl, CancellationToken cancellationToken) where TMessage : class

Parameters

queueUrl string
cancellationToken CancellationToken

Returns

Task<List<TMessage>>

A Task representing the asynchronous operation.

Type Parameters

TMessage

The type of message being polled.

RecordReceiveResultAsync(int, TimeSpan)

Records the result of a receive operation to update strategy calculations.

ValueTask RecordReceiveResultAsync(int messageCount, TimeSpan actualWaitTime)

Parameters

messageCount int

The number of messages received.

actualWaitTime TimeSpan

The actual time spent waiting.

Returns

ValueTask