@onlineapps/service-wrapper 2.0.26 → 2.0.27

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/service-wrapper",
3
- "version": "2.0.26",
3
+ "version": "2.0.27",
4
4
  "description": "Thin orchestration layer for microservices - delegates all infrastructure concerns to specialized connectors",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -27,7 +27,7 @@
27
27
  "@onlineapps/conn-base-cache": "^1.0.0",
28
28
  "@onlineapps/conn-base-monitoring": "^1.0.1",
29
29
  "@onlineapps/conn-infra-error-handler": "^1.0.0",
30
- "@onlineapps/conn-infra-mq": "^1.1.6",
30
+ "@onlineapps/conn-infra-mq": "^1.1.7",
31
31
  "@onlineapps/conn-orch-api-mapper": "^1.0.0",
32
32
  "@onlineapps/conn-orch-cookbook": "^2.0.0",
33
33
  "@onlineapps/conn-orch-orchestrator": "^1.0.1",
@@ -151,13 +151,10 @@ class ServiceWrapper {
151
151
  await this._initializeMonitoring();
152
152
  }
153
153
 
154
- // 2. Initialize MQ connection (needed for workflow.init listener)
154
+ // 2. Initialize MQ connection
155
155
  if (this.config.wrapper?.mq?.enabled !== false) {
156
156
  await this._initializeMQ();
157
-
158
- // Start workflow.init listener immediately (independent of service registration)
159
- // This allows the system to receive workflow messages even if service validation/registration fails
160
- await this._startWorkflowInitListener();
157
+ // NOTE: workflow.init listener starts ONLY after successful registration (see _initializeRegistry)
161
158
  }
162
159
 
163
160
  // 3. Run pre-validation (Tier 1)
@@ -315,13 +312,16 @@ class ServiceWrapper {
315
312
  console.log(`✓ Certificate received: ${registrationResult.certificate.certificateId}`);
316
313
  }
317
314
 
318
- // CRITICAL: Only start service-specific workflow listener after successful validation and registration with certificate
319
- // workflow.init listener is already running (started during MQ initialization)
315
+ // CRITICAL: Start workflow listeners ONLY after successful validation and registration with certificate
316
+ // Both workflow.init and service-specific listeners start here
320
317
  if (registrationResult.success && registrationResult.certificate) {
321
- console.log('✓ Certificate validated, starting service-specific workflow listener...');
318
+ console.log('✓ Certificate validated, starting workflow listeners...');
319
+ // Start workflow.init listener (for all services)
320
+ await this._startWorkflowInitListener();
321
+ // Start service-specific workflow listener
322
322
  await this._startServiceWorkflowListener();
323
323
  } else {
324
- console.warn('⚠ Registration succeeded but no certificate received - service-specific workflow listener NOT started');
324
+ console.warn('⚠ Registration succeeded but no certificate received - workflow listeners NOT started');
325
325
  }
326
326
 
327
327
  } catch (error) {
@@ -455,8 +455,8 @@ class ServiceWrapper {
455
455
  }
456
456
 
457
457
  /**
458
- * Start workflow.init listener (runs independently of service registration)
459
- * This allows the system to receive workflow messages even if service validation/registration fails
458
+ * Start workflow.init listener (runs ONLY after successful registration)
459
+ * Service must be registered and have a certificate before listening to workflow.init
460
460
  * @private
461
461
  */
462
462
  async _startWorkflowInitListener() {
@@ -470,7 +470,7 @@ class ServiceWrapper {
470
470
  await this._processWorkflowMessage(message, 'workflow.init');
471
471
  });
472
472
 
473
- console.log('✓ workflow.init listener started (independent of service registration)');
473
+ console.log('✓ workflow.init listener started (after successful registration)');
474
474
  }
475
475
 
476
476
  /**