Interface ILongPollingStrategy
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
GetCurrentLoadFactorAsync()
Gets the current load factor (0.0 to 1.0) based on recent message patterns.
ValueTask<double> GetCurrentLoadFactorAsync()
Returns
PollAsync<TMessage>(string, CancellationToken)
Executes the polling strategy.
Task<List<TMessage>> PollAsync<TMessage>(string queueUrl, CancellationToken cancellationToken) where TMessage : class
Parameters
queueUrlstringcancellationTokenCancellationToken
Returns
Type Parameters
TMessageThe 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
messageCountintThe number of messages received.
actualWaitTimeTimeSpanThe actual time spent waiting.