انتقل إلى المحتوى الرئيسي

Class: InProcessBus

Defined in: packages/messaging/src/in-process.ts:48

The in-process adapter: delivers a request to a module hosted by the same deployable without touching the broker, and owes everything the broker gives (chapter 02, two adapters behind send()). The obligations are met by construction rather than repeated here:

  • the envelope is encoded to headers by the sender and decoded by the Receiver, the same code as the broker path;
  • validation, scope minting, the tenant assertion and the deadline are in Receiver.handle, which both adapters call;
  • the body and the reply are structured clones, so a caller cannot depend on object identity;
  • it returns a Reply, never throws across the boundary;
  • it takes no transaction handle: the type has no place for one.

It additionally refuses, at wiring and again per call, an edge the permission table does not list, and it is the only writer of the envelope's callerModule (D2.2): set from the caller the wiring names, whatever header the sender supplied, so a module cannot claim to be another. The receiver refuses one that disagrees with the caller, and any at all on the broker.

Constructors​

Constructor​

new InProcessBus(host, hosting?): InProcessBus

Defined in: packages/messaging/src/in-process.ts:58

Parameters​

host​

"gateway" | "gateway-admin" | "audit" | "provisioning" | "bootstrap" | "credential" | "agent-shared"

The deployable this process is.

hosting?​

HostingInput

Defaults to the real estate; tests pass a table of their own.

Returns​

InProcessBus

Properties​

host​

readonly host: "gateway" | "gateway-admin" | "audit" | "provisioning" | "bootstrap" | "credential" | "agent-shared"

Defined in: packages/messaging/src/in-process.ts:50

The deployable this bus lives in.

Methods​

assertEdge()​

assertEdge(caller, key): void

Defined in: packages/messaging/src/in-process.ts:90

Refuses an edge that is not a listed, co-hosted one.

Parameters​

caller​

Participant

The calling participant.

key​

string

The registry key it will call.

Returns​

void

Throws​

The edge is not one this deployable may carry.


deliver()​

deliver(request): Promise<ReceiveOutcome>

Defined in: packages/messaging/src/in-process.ts:110

Delivers one request to the receiver of the module its subject names. A module with no receiver on this bus answers MODULE_UNAVAILABLE, as a broker with no responder would.

Parameters​

request​

InProcessRequest

Returns​

Promise<ReceiveOutcome>

The receiver's outcome, with the reply cloned. Never throws.


register()​

register(receiver): void

Defined in: packages/messaging/src/in-process.ts:70

Makes a module reachable in process.

Parameters​

receiver​

Served

The module's receiver.

Returns​

void

Throws​

The module is not hosted by this deployable, or is already registered.