@onlineapps/conn-orch-registry 1.1.24 → 1.1.25

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onlineapps/conn-orch-registry",
3
- "version": "1.1.24",
3
+ "version": "1.1.25",
4
4
  "license": "MIT",
5
5
  "description": "Connector-registry-client provides the core communication mechanism for microservices in this environment. It enables them to interact with a services_registry to receive and fulfill tasks by submitting heartbeats or their API descriptions.",
6
6
  "keywords": [
@@ -75,63 +75,33 @@ class ServiceRegistryClient extends EventEmitter {
75
75
  console.log(`[RegistryClient] ${this.serviceName}: ⚠️ No validation proof - will use Tier 2 validation`);
76
76
  }
77
77
 
78
- // Create service-specific response queue
79
- this.serviceResponseQueue = `${this.serviceName}.responses`;
80
-
81
- // Create service-specific registry event queue (for certificate delivery)
78
+ // FÁZE 0.5: Vytvoření service-specific front
79
+ const queueCreationStartTime = Date.now();
82
80
  this.serviceRegistryQueue = `${this.serviceName}.registry`;
83
-
84
- // Ensure existence of service-specific queues only (infrastructure queues must already exist)
85
- await this.queueManager.ensureQueues([this.serviceResponseQueue, this.serviceRegistryQueue]);
86
-
87
- // CRITICAL: Before consume(), we must assertQueue with correct parameters
88
- // amqplib's channel.consume() may internally call assertQueue() WITHOUT parameters
89
- // This causes 406 PRECONDITION-FAILED if queue exists with different arguments
90
- console.log(`[RegistryClient] [CONSUMER] About to consume from ${this.serviceResponseQueue}`);
91
- console.log(`[RegistryClient] [CONSUMER] ⚠ WARNING: amqplib's channel.consume() may internally call assertQueue() WITHOUT parameters`);
92
- console.log(`[RegistryClient] [CONSUMER] ⚠ WARNING: Queue should already be asserted by ensureQueues() above with correct parameters from queueConfig.js`);
81
+ console.log(`[FÁZE 0.5] Service Queue Creation - STARTING`);
93
82
 
94
- // Start consuming service response queue for registry responses
95
- const CONSUME_TIMEOUT = 5000; // 5 seconds
96
- const consumeResponsePromise = this.queueManager.channel.consume(
97
- this.serviceResponseQueue,
98
- msg => {
99
- // Handle null message (queue deleted, connection closed, consumer canceled)
100
- if (!msg) {
101
- console.warn(`[RegistryClient] ${this.serviceName}: Received null message from ${this.serviceResponseQueue} (queue may be deleted or connection closed)`);
102
- return;
103
- }
104
- try {
105
- this._handleRegistryMessage(msg);
106
- } catch (error) {
107
- console.error(`[RegistryClient] ${this.serviceName}: Error in consume callback:`, error);
108
- // Nack message on error
109
- try {
110
- this.queueManager.channel.nack(msg, false, false);
111
- } catch (nackErr) {
112
- console.error(`[RegistryClient] ${this.serviceName}: Failed to nack message:`, nackErr);
113
- }
114
- }
115
- },
116
- { noAck: false }
117
- );
118
- const consumeResponseTimeoutPromise = new Promise((_, reject) => {
119
- setTimeout(() => {
120
- reject(new Error(`consume() timeout for ${this.serviceResponseQueue} after ${CONSUME_TIMEOUT}ms`));
121
- }, CONSUME_TIMEOUT);
122
- });
123
-
124
83
  try {
125
- await Promise.race([consumeResponsePromise, consumeResponseTimeoutPromise]);
126
- } catch (consumeErr) {
127
- throw new Error(`[RegistryClient] ${this.serviceName}: Failed to start consumer on ${this.serviceResponseQueue}: ${consumeErr.message}`);
84
+ // Ensure existence of service-specific queue only (infrastructure queues must already exist)
85
+ await this.queueManager.ensureQueues([this.serviceRegistryQueue]);
86
+ console.log(`[FÁZE 0.5] Service Queue Creation - PASSED (${Date.now() - queueCreationStartTime}ms)`);
87
+ } catch (error) {
88
+ console.error(`[FÁZE 0.5] Service Queue Creation - FAILED: ${error.message}`);
89
+ throw error;
128
90
  }
129
91
 
130
- // CRITICAL: Also listen on registry event queue for certificate delivery
92
+ // FÁZE 0.6: Spuštění konzumerů
93
+ const consumerStartTime = Date.now();
94
+ console.log(`[FÁZE 0.6] Consumer Startup - STARTING`);
95
+
96
+ // CRITICAL: Before consume(), we must assertQueue with correct parameters
97
+ // amqplib's channel.consume() may internally call assertQueue() WITHOUT parameters
98
+ // This causes 406 PRECONDITION-FAILED if queue exists with different arguments
131
99
  console.log(`[RegistryClient] [CONSUMER] About to consume from ${this.serviceRegistryQueue}`);
132
100
  console.log(`[RegistryClient] [CONSUMER] ⚠ WARNING: amqplib's channel.consume() may internally call assertQueue() WITHOUT parameters`);
133
101
  console.log(`[RegistryClient] [CONSUMER] ⚠ WARNING: Queue should already be asserted by ensureQueues() above with correct parameters from queueConfig.js`);
134
102
 
103
+ // Start consuming service registry queue for registry responses and events
104
+ const CONSUME_TIMEOUT = 5000; // 5 seconds
135
105
  const consumeRegistryPromise = this.queueManager.channel.consume(
136
106
  this.serviceRegistryQueue,
137
107
  msg => {
@@ -162,7 +132,9 @@ class ServiceRegistryClient extends EventEmitter {
162
132
 
163
133
  try {
164
134
  await Promise.race([consumeRegistryPromise, consumeRegistryTimeoutPromise]);
135
+ console.log(`[FÁZE 0.6] Consumer Startup - PASSED (${Date.now() - consumerStartTime}ms)`);
165
136
  } catch (consumeErr) {
137
+ console.error(`[FÁZE 0.6] Consumer Startup - FAILED: ${consumeErr.message}`);
166
138
  throw new Error(`[RegistryClient] ${this.serviceName}: Failed to start consumer on ${this.serviceRegistryQueue}: ${consumeErr.message}`);
167
139
  }
168
140
  }
@@ -384,7 +356,7 @@ class ServiceRegistryClient extends EventEmitter {
384
356
  spec: serviceInfo.spec || null,
385
357
  validationToken: serviceInfo.token || serviceInfo.validationToken,
386
358
  tokenSecret: serviceInfo.secret || serviceInfo.tokenSecret,
387
- responseQueue: this.serviceResponseQueue, // Queue for registry to send response
359
+ responseQueue: this.serviceRegistryQueue, // Queue for registry to send response
388
360
  timestamp: new Date().toISOString()
389
361
  };
390
362