Dispatcher

public protocol Dispatcher : Module

A Module that implements the functionality of dispatching some track requests towards some entity that can handle the events.

  • dispatchLimit Default implementation

    The maximum amount of Dispatches that are accepted in a single dispatch call. Default is 1.

    Default Implementation

    Declaration

    Swift

    var dispatchLimit: Int { get }
  • Sends the provided Dispatches to some specific entity to handle them.

    Declaration

    Swift

    func dispatch(_ data: [Dispatch], completion: @escaping ([Dispatch]) -> Void) -> Disposable

    Parameters

    data

    The Dispatches that have to be sent. They will always be less then or equal to the dispatchLimit.

    completion

    The callback that needs to be called when one or more Dispatches have completed. Completed in this case means both if it succeeded, or if it failed and won’t be retried. This callback can be called multiple times, but must contain each Dispatch exactly once. All Dispatches provided in the data parameter need to be passed back in the completion block at some point to allow for it to be cleared from the queue and avoid multiple dispatches of the same events.

    Return Value

    A Disposable that can be used to cancel the dispatch process if still in progress.