@onlineapps/conn-orch-orchestrator 2.0.1 → 2.0.2

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-orchestrator",
3
- "version": "2.0.1",
3
+ "version": "2.0.2",
4
4
  "description": "Workflow orchestration connector for OA Drive - handles message routing and workflow execution",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -173,23 +173,29 @@ class WorkflowOrchestrator {
173
173
  async processWorkflowMessage(message, serviceName) {
174
174
  const { workflow_id, cookbook: cookbookDef, current_step } = message;
175
175
  const startTime = Date.now();
176
-
177
- // Fail-fast: correlation_id MUST be present on every workflow message.
178
- // A workflow without a correlation_id is malformed per RFC §5.8
179
- // (ContextBuilder._validateMqMessage rejects empty strings too).
180
- // The gateway must publish it; if it does not, that is a gateway bug
181
- // we want to surface loudly rather than silently produce 500s inside
182
- // invokeOperation's ContextBuilder.
176
+ // correlation_id is required by RFC §5.8 — validated below inside the
177
+ // try block so malformed messages flow through the retry/DLQ pipeline
178
+ // and a `failed` monitoring event is emitted (no silent redelivery).
183
179
  const correlationId = this._extractCorrelationId(message);
184
- if (typeof correlationId !== 'string' || correlationId.length === 0) {
185
- throw new Error(
186
- '[WorkflowOrchestrator] message.correlation_id is required - ' +
187
- `Expected non-empty string on inbound workflow message (workflow_id='${workflow_id}', step='${current_step}'). ` +
188
- 'Fix: ensure publisher (gateway / router) sets correlation_id on message body per RFC §5.8.'
189
- );
190
- }
191
180
 
192
181
  try {
182
+ // Fail-fast: correlation_id MUST be present on every workflow message.
183
+ // (ContextBuilder._validateMqMessage rejects empty strings too.)
184
+ // Gateway is expected to publish it; if it does not, that is a gateway
185
+ // bug we want to surface loudly rather than silently produce 500s
186
+ // inside invokeOperation's ContextBuilder.
187
+ if (typeof correlationId !== 'string' || correlationId.length === 0) {
188
+ const err = new Error(
189
+ '[WorkflowOrchestrator] message.correlation_id is required - ' +
190
+ `Expected non-empty string on inbound workflow message (workflow_id='${workflow_id}', step='${current_step}'). ` +
191
+ 'Fix: ensure publisher (gateway / router) sets correlation_id on message body per RFC §5.8.'
192
+ );
193
+ err.errorCode = 'MISSING_CORRELATION_ID';
194
+ err.statusCode = 400;
195
+ err.type = 'VALIDATION';
196
+ throw err;
197
+ }
198
+
193
199
  // Validate cookbook structure
194
200
  this.cookbook.validateCookbook(cookbookDef);
195
201