CommandDispatcher
open class CommandDispatcher : Dispatcher
Base class for command-based dispatchers that route dispatches through an internal command registry.
Provides a concrete implementation for dispatch() that supports async commands
with cancellation via Disposable, calling completion once per Dispatch as it finishes.
Usage
class MyVendorDispatcher: CommandDispatcher {
private let vendorInstance: VendorInterface
init(context: TealiumContext, vendorInstance: VendorInterface) {
self.vendorInstance = vendorInstance
super.init(
id: "MyVendor",
version: "1.0.0",
commands: [...],
logCategory: "MyVendor",
queue: context.queue,
logger: context.logger
)
}
}
-
Declaration
Swift
public let id: String -
Declaration
Swift
public let version: String -
Declaration
Swift
open var dispatchLimit: Int { get }
-
Undocumented
Declaration
Swift
public let logger: LoggerProtocol? -
Undocumented
Declaration
Swift
public let logCategory: String
-
Designated initializer for subclasses.
Declaration
Swift
public init(id: String, version: String, commands: [Command], logCategory: String, queue: TealiumQueue, logger: LoggerProtocol?)
-
Declaration
Swift
open func dispatch(_ data: [Dispatch], completion: @escaping ([Dispatch]) -> Void) -> any Disposable
View on GitHub