Table of Contents

Class LimitedPriorityQueue

Namespace
Sportradar.LiveData.Sdk.Services.PriorityQueue
Assembly
Sportradar.LiveData.Sdk.dll

Extends basic PriorityQueue implementation by checking the queue capacity limits and lo-hi queue watermarks. Whenever one of those thresholds are breached an OnLimits event is triggered. Lo watermark can be used to detect that a queue is slowly getting filled up and there is still time to react to this. High watermark usually triggers some self-defense mechanism like stopping all incoming message delivery and processing. This is a thread-safe implementation.

public class LimitedPriorityQueue : PriorityQueue, ILimitedPriorityQueue, IPriorityQueue
Inheritance
LimitedPriorityQueue
Implements
Inherited Members

Constructors

LimitedPriorityQueue(ISdkLogger, ISdkConfiguration)

public LimitedPriorityQueue(ISdkLogger sdk_logger, ISdkConfiguration config)

Parameters

sdk_logger ISdkLogger
config ISdkConfiguration

Fields

m_config

protected ISdkConfiguration m_config

Field Value

ISdkConfiguration

m_high_limit_reached

protected bool m_high_limit_reached

Field Value

bool

m_low_limit_reached

protected bool m_low_limit_reached

Field Value

bool

Methods

Clear()

Empties the queue.

public override void Clear()

Dequeue()

Dequeues an object from the priority queue. Returns null if the queue is empty

public override PriorityQueueElt Dequeue()

Returns

PriorityQueueElt

The top item (max priority) from the queue or null if it does not exist.

Dequeue(Priority)

Dequeues an object of specific priority from the priority queue. Returns null if the queue is empty.

public override PriorityQueueElt Dequeue(Priority prio)

Parameters

prio Priority

Priority constraint

Returns

PriorityQueueElt

The top item (max priority) from the queue or null if it does not exist.

Dequeue(Priority, TimeSpan)

Dequeues an object of specific priority from the priority queue.

public override PriorityQueueElt Dequeue(Priority prio, TimeSpan timeout)

Parameters

prio Priority

Priority constraint

timeout TimeSpan

The number of milliseconds to wait

Returns

PriorityQueueElt

The top item (max priority) from the queue. Returns null in case of timeout.

Dequeue(TimeSpan)

Dequeues an object from the priority queue.

public override PriorityQueueElt Dequeue(TimeSpan timeout)

Parameters

timeout TimeSpan

The number of milliseconds to wait

Returns

PriorityQueueElt

The top item (max priority) from the queue. Returns null in case of timeout.

Enqueue(PriorityQueueElt)

Enqueues an item to the priority queue.

public override void Enqueue(PriorityQueueElt elt)

Parameters

elt PriorityQueueElt

Events

OnLimits

Signals that a queue limit (HIGH, LOW, NORMAL) has been reached or retreated for a specific queue.

public event LimitedPriorityQueueDelegates.QueueLimitDelegate OnLimits

Event Type

LimitedPriorityQueueDelegates.QueueLimitDelegate