AX#

Search Results for

    Show / Hide Table of Contents

    Class PriorityRequestDispatcher

    Schedules PLC access requests by eAccessPriority class.

    Ordering: High before UserInterface before Normal before Low; FIFO within a class. Custom schedules as Normal.

    Concurrency: N worker loops are the sole concurrency mechanism (no semaphore); in-flight work never exceeds N. One worker is dedicated to UserInterface/High (structural reservation) so user-facing work never queues behind background work; with N = 1 the single worker serves all classes and the reservation is void.

    Starvation: a waiting Low item is promoted one class per AgingIntervalMs, capped at Normal — aged work never enters the reserved user-interface lane.

    Inheritance
    object
    PriorityRequestDispatcher
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: AXSharp.Connector
    Assembly: AXSharp.Connector.dll
    Syntax
    public sealed class PriorityRequestDispatcher

    Constructors

    | Edit this page View Source

    PriorityRequestDispatcher(int)

    Creates the dispatcher with the given number of worker slots.

    Declaration
    public PriorityRequestDispatcher(int workerCount)
    Parameters
    Type Name Description
    int workerCount

    Number of concurrent slots; clamped to 1..4 — the PLC WebAPI destabilizes above 4 concurrent requests.

    Properties

    | Edit this page View Source

    AgingIntervalMs

    Milliseconds of waiting after which a queued item is promoted one priority class (capped at Normal).

    Declaration
    public int AgingIntervalMs { get; set; }
    Property Value
    Type Description
    int
    | Edit this page View Source

    InFlightCount

    Gets the number of items currently executing.

    Declaration
    public int InFlightCount { get; }
    Property Value
    Type Description
    int
    | Edit this page View Source

    IsPaused

    Gets whether dispatching is paused.

    Declaration
    public bool IsPaused { get; }
    Property Value
    Type Description
    bool
    | Edit this page View Source

    OnUiLatencyBreach

    Invoked when a UserInterface batch exceeds UserInterfaceLatencyBudgetMs.

    Declaration
    public Action<UiLatencyBreach> OnUiLatencyBreach { get; set; }
    Property Value
    Type Description
    Action<UiLatencyBreach>
    | Edit this page View Source

    PausedEnqueueTtlMs

    Milliseconds a queued item may spend in the paused state before it faults with a re-authentication error.

    Declaration
    public int PausedEnqueueTtlMs { get; set; }
    Property Value
    Type Description
    int
    | Edit this page View Source

    QueuedCount

    Gets the number of queued (not yet dispatched) items.

    Declaration
    public int QueuedCount { get; }
    Property Value
    Type Description
    int
    | Edit this page View Source

    UserInterfaceLatencyBudgetMs

    Latency budget in milliseconds applied to whole UserInterface batches.

    Declaration
    public int UserInterfaceLatencyBudgetMs { get; set; }
    Property Value
    Type Description
    int
    | Edit this page View Source

    WorkerCount

    Gets the effective worker (concurrency slot) count, clamped to 1..4.

    Declaration
    public int WorkerCount { get; }
    Property Value
    Type Description
    int

    Methods

    | Edit this page View Source

    EnqueueAsync(Func<Task>, eAccessPriority)

    Enqueues a single work item; the returned task completes when the item has executed (or faults with the item's exception, or with TimeoutException if it expired while paused).

    Declaration
    public Task EnqueueAsync(Func<Task> work, eAccessPriority priority)
    Parameters
    Type Name Description
    Func<Task> work
    eAccessPriority priority
    Returns
    Type Description
    Task
    | Edit this page View Source

    EnqueueBatchAsync(IReadOnlyList<Func<Task>>, eAccessPriority, int)

    Dispatches a batch of chunks. With interChunkDelayMs of 0 all chunks are enqueued at once and run concurrently; with a positive delay chunks run serially with the delay elapsing between them (the delay never occupies a worker slot). Measures the whole batch and raises OnUiLatencyBreach for UserInterface batches exceeding the budget. The result's ChunkTasks are settled; this method does not throw on chunk failures — inspect the tasks.

    Declaration
    public Task<BatchDispatchResult> EnqueueBatchAsync(IReadOnlyList<Func<Task>> chunks, eAccessPriority priority, int interChunkDelayMs)
    Parameters
    Type Name Description
    IReadOnlyList<Func<Task>> chunks
    eAccessPriority priority
    int interChunkDelayMs
    Returns
    Type Description
    Task<BatchDispatchResult>
    | Edit this page View Source

    PauseAsync()

    Stops dequeueing and completes when all in-flight items have finished. Queued items are retained but fault with TimeoutException once they spend longer than PausedEnqueueTtlMs paused.

    Declaration
    public Task PauseAsync()
    Returns
    Type Description
    Task
    | Edit this page View Source

    Resume()

    Resumes dispatching; the backlog drains in priority order.

    Declaration
    public void Resume()
    • Edit this page
    • View Source
    In this article
    Back to top Generated by DocFx. © MTS spol. s r.o. and awesome contributors