Uploaded image for project: 'Nuxeo Platform'
  1. Nuxeo Platform
  2. NXP-19880

Fix Automation triggered by scheduler

    XMLWordPrintable

    Details

      Description

      Given a cron:

        <extension target="org.nuxeo.ecm.core.scheduler.SchedulerService"
            point="schedule">
          <schedule id="stuff">
            <username>Administrator</username>
            <eventId>doStuff</eventId>
            <eventCategory>default</eventCategory>
            <cronExpression>0/30 * * * * ?</cronExpression>
          </schedule>
        </extension>
      

      and a listener on `doStuff` bound to an automation operation/chain/script with the given code for instance:

      function run(input, params) {
        Auth.LoginAs(null, {});
        var query = "SELECT * FROM Document WHERE ecm:primaryType = 'CommentExpiry' '";
        var subDocs = Document.Query(null, {
          "query": query
        }
      }
      

      No core session will be found when executing the query:

      Caused by: org.nuxeo.ecm.core.api.NuxeoException: cannot find core session
      	at org.nuxeo.ecm.platform.query.nxql.CoreQueryDocumentPageProvider.getCoreSession(CoreQueryDocumentPageProvider.java:272)
      	at org.nuxeo.ecm.platform.query.nxql.CoreQueryDocumentPageProvider.getCurrentPage(CoreQueryDocumentPageProvider.java:112)
      	at org.nuxeo.ecm.automation.core.util.PaginablePageProvider.<init>(PaginablePageProvider.java:41)
      	at org.nuxeo.ecm.automation.jaxrs.io.documents.PaginableDocumentModelListImpl.<init>(PaginableDocumentModelListImpl.java:49)
      	at org.nuxeo.ecm.automation.core.operations.services.query.DocumentPaginatedQuery.run(DocumentPaginatedQuery.java:149)
      

      Even if the username has been defined in the cron scheduler.

        Attachments

          Activity

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated: