One bus: the runtime pins the certificate after the server speaks, and the old transport goes
Every module that dialled the new bus failed its handshake with "wrong version number": the runtime pinned the server's certificate by a raw TLS connection to a port on which the server speaks first, in the clear. The pin is taken after the INFO line now, on the same socket, and then the real connection verifies against exactly that certificate. And the old transport is deleted — its client, its tests, its dependency — with the wire-compatibility pins that only existed for the move (novox/hq ADR 0131, design 28 task 5.5). A credential names the bus, and there is one.
This commit is contained in:
+5
-9
@@ -22,9 +22,7 @@
|
||||
|
||||
import { readFileSync } from "node:fs";
|
||||
import { pathToFileURL } from "node:url";
|
||||
import { connectAmqp, fatalBrokerReason as fatalAmqpReason } from "./broker-amqp.js";
|
||||
import { connectNats, fatalBrokerReason as fatalNatsReason } from "./broker-nats.js";
|
||||
import type { Credential } from "./broker-amqp.js";
|
||||
import { connectNats, fatalBrokerReason as fatalNatsReason, type Credential } from "./broker-nats.js";
|
||||
import { runTools } from "./runtime.js";
|
||||
import { invokeTool } from "@novox/mesh-sdk/tools";
|
||||
import { useBroker } from "@novox/mesh-sdk/messaging";
|
||||
@@ -39,7 +37,7 @@ import { emit } from "@novox/mesh-sdk/events";
|
||||
// fatalBrokerReasonFor is the reason a connection failure is final rather than "not yet", for
|
||||
// whichever bus this runtime is on — each transport knows its own refusals.
|
||||
function fatalBrokerReasonFor(err: unknown): string | null {
|
||||
return fatalNatsReason(err) ?? fatalAmqpReason(err);
|
||||
return fatalNatsReason(err);
|
||||
}
|
||||
|
||||
async function connectBroker(): Promise<Broker> {
|
||||
@@ -66,10 +64,8 @@ async function connectBroker(): Promise<Broker> {
|
||||
// nothing else in its environment changed (design 25; novox/hq design 28 task 5.2). The scheme
|
||||
// is enough to know which bus to speak; a runtime that always dialled the old one would keep
|
||||
// serving and answer nobody.
|
||||
if (credential.url.startsWith("nats://")) {
|
||||
return connectNats(credential);
|
||||
}
|
||||
return connectAmqp(credential, { assumeExchanges: true });
|
||||
// One bus (novox/hq ADR 0131, design 28 task 5.5): the credential names it, and it is this.
|
||||
return connectNats(credential);
|
||||
}
|
||||
const url = process.env.MESH_BROKER_URL;
|
||||
if (!url) {
|
||||
@@ -78,7 +74,7 @@ async function connectBroker(): Promise<Broker> {
|
||||
);
|
||||
process.exit(1);
|
||||
}
|
||||
return connectAmqp(url);
|
||||
return connectNats({ url });
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user