Interface ScriptContextPublisher
script.context broker topic.
Scripts (and the runtime that hosts them) call into this interface to expose
trace lines, lifecycle state changes, and freeform annotations to whoever is
watching the topic — primarily NXTDebugger. Calls are non-blocking:
the implementation enqueues onto a bounded ring and an internal worker thread
forwards each entry as an _debug.publish RPC. Overflows drop the
oldest entry rather than blocking the caller, mirroring the agent's per-pipe
push queue.
When no debugger has subscribed, the agent's broker still accepts the
publish and discards it — the per-method cost is one round-trip on the pipe,
but the auto-tap fast-path keeps it off rpc.tap.
The NOOP instance is returned by ScriptContext.getScriptContext()
when no channel is wired (tests, disconnected runtimes). Callers should never
null-check the publisher; they always get a usable instance.
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionvoidannotation(String key, Object value) Script-defined named annotation.voidLifecycle state notification with no further detail.voidLifecycle state notification with an optional human-readable detail.voidFree-form trace line.
-
Field Details
-
NOOP
No-op publisher. Returned when no channel has been wired into the script context. All four methods are no-ops; never throws.
-
-
Method Details
-
state
Lifecycle state notification with no further detail. -
state
-
trace
-
annotation
-