IMQClient class
Base class for service clients.
Subclass it and declare every remote method as @remote() async m(...args) \{ return await this.remoteCall<T>(...arguments); \}, or let IMQClient.create() generate the subclass from a running service's description.
Signature:
export declare abstract class IMQClient extends EventEmitter
Extends: EventEmitter
Remarks
Abstractness is enforced at runtime as well as by the type system: constructing IMQClient directly throws a TypeError.
Instances are EventEmitters. Besides ordinary calls, any response that no longer has a pending caller is emitted as an event named after the remote method, carrying the raw IMQRPCResponse — the escape hatch for replies to calls made by a process that has since died.
The identity properties pair up as follows: IMQClient.serviceName is where calls go, IMQClient.queueName is where answers come back, IMQClient.name identifies this client, IMQClient.hostName identifies the machine plus instance, and IMQClient.id is the per-host instance slot.
Constructors
|
Constructor |
Modifiers |
Description |
|---|---|---|
|
Constructs a client. |
Properties
|
Property |
Modifiers |
Type |
Description |
|---|---|---|---|
|
|
string |
Machine-scoped identity, | |
|
|
number |
Per-host instance slot number — not an OS process id. | |
|
|
string |
This client's unique identity, | |
|
|
The effective options for this client: DEFAULT_IMQ_CLIENT_OPTIONS merged with the values passed to the constructor. | ||
|
|
string |
The local side: the queue replies come back on, and the value placed in | |
|
|
string |
The remote side: the queue every request is addressed to, and the pub/sub channel IMQClient.subscribe() listens on. |
Methods
|
Method |
Modifiers |
Description |
|---|---|---|
|
Publishes the given payload on this client's own queue channel (IMQClient.queueName). | ||
|
|
Generates a client for the service registered under the given queue name and resolves to the generated namespace object — not to a client instance, and not to an IMQClient. | |
|
Returns service description metadata. | ||
|
Destroys client | ||
|
|
Sends a call to the remote service method. Intended to be invoked as | |
|
Initializes client work | ||
|
Stops client work | ||
|
Subscribes to the service's event channel, named after IMQClient.serviceName — the same channel a service's | ||
|
Stops receiving service events: unsubscribes the channel, discards every handler registered through IMQClient.subscribe(), and closes the dedicated subscription connection. |
Read this page as plain markdown — no HTML, no navigation. For pasting into an LLM, or for an agent to fetch.