Uploaded image for project: 'OpenIDM'
  1. OpenIDM
  2. OPENIDM-3972

Sync Failure handling calls to onSyncFailure.js-deadLetterQueue do not work

    Details

    • Story Points:
      2

      Description

      Sync Failure handling with custom script not working anymore.
      The automated test we have used a script that was like that:

      // sample onSyncFailure script that just logs the error
      (function () {
          logger.warn("onSyncFailure script invoked with systemIdentifier: {} objectType: {} failedRecordUid: {} failedRecord: {} exception {}", 
              syncFailure.systemIdentifier, 
              syncFailure.objectType, 
              syncFailure.uid,
              syncFailure.failedRecord,
              failureCause.toString());
      	failureHandlers.deadLetterQueue.invoke(syncFailure, failureCause);
      }());
      

      I saw that commit 80a21b2f138 seems to add the parameter "context" to the invoke method, so I updated the script to:

      (...)
      	failureHandlers.deadLetterQueue.invoke(context, syncFailure, failureCause);
      (...)
      

      But it still does not work.
      Looking at the code, I suspect there is a bad copy/paste in here:

          public void invoke(Context context, Map<String, Object> syncFailure, Exception failureCause)
              throws SyncHandlerException {
      
              if (null == scriptEntry) {
                  throw new SyncHandlerException("No script registered");
              }
      
              Script script = scriptEntry.getScript(new RootContext());
              script.put("context", syncFailure);  <== should probably be ("context", context)
              script.put("syncFailure", syncFailure);
              script.put("failureCause", failureCause);
              script.put("failureHandlers", builtInHandlers);
      

      If so, it could explain why I could not make Sync Failure handled by script working.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                brmiller Brendan Miller
                Reporter:
                laurent.bristiel Laurent Bristiel [X] (Inactive)
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: