interface BrokerRuntime
Since 0.2.0

The runtime capabilities this broker needs. IRuntimeServices satisfies it.

Narrower than the whole of IRuntimeServices for the reason JobIdSource is: interface segregation (AI_GUIDELINES §1.1), so a test double implements the four members that are read rather than the dozens that are not. It is still a port rather than direct crypto/setTimeout calls, because §4.2 routes every runtime capability through IRuntimeServices — which is why the plugin constructs this class.

Methods

uuid(): string

A fresh unique id, for message ids, correlation ids, and inbox addresses.

now(): number

Wall-clock milliseconds, for MessageMetadata.timestamp.

setTimeout(
fn: () => void,
ms: number
): TimerHandle

Schedules a reply timeout.

clearTimeout(handle: TimerHandle): void

Cancels a reply timeout.

Usage

import { type BrokerRuntime } from "cloudflare-plugin/src/index.ts";