This commit is contained in:
2026-04-17 17:35:37 -04:00
parent 6f118107d9
commit ba6bd5e0c2
2 changed files with 23 additions and 7 deletions

View File

@@ -1,5 +1,6 @@
// ZeroMQ DEALER client connecting to Flink IngestorBroker (ROUTER, port 5567)
import * as zmq from 'zeromq';
import os from 'os';
import {
DataRequest,
WorkerReady, WorkComplete, WorkHeartbeat, WorkReject, WorkStop,
@@ -44,6 +45,13 @@ export class ZmqClient {
this.dealerSocket = new zmq.Dealer();
// Set a stable routing ID so the ROUTER always recognises this peer, even
// after a TCP reconnect. Without this, ZMQ assigns a new random identity
// on every reconnect, leaving dead slots in the broker's queue → Errno 65.
const stableId = os.hostname();
this.dealerSocket.routingId = stableId;
this.logger.info({ routingId: stableId }, 'Set stable DEALER routing ID');
// Subscribe to connection events BEFORE calling connect() so we catch the
// initial establishment. The 'connect' event fires on initial TCP handshake
// and again after every ZMQ reconnect (e.g. Flink restart).