AnsweredAssumed Answered

Running Rules in Background to delete nodes

Question asked by jlabuelo on Jun 2, 2009
Latest reply on Jun 5, 2009 by jlabuelo
Good Morning all

we are having a problem with running rules in Background mode in Alfresco. Basically what we have created in one of our spaces is a background rule so everytime a
"name.tif"
file is placed in the space, the system calls the OCR Intelliant transformer and creates the
"name.pdf"
file with the same content in a Read - PDF mode.

As I said this rule is configured to be run in Background mode.

Then in the same space we have created another rule… this time automatic (No background) to run a js script that must delete the "name.tif" file once the "name.pdf" file exists.

The Java script code is as easy as this:
var namepdf = document.name;
var nametif = namepdf.replace("pdf","tif");
var delet = space.childByNamePath(nametif);
if (delet != null)
{
   delet.remove();
}

This uses to work fine 98% of the times. Basically we want

a) Create a Tif file
b) Transform it in PDF using Intelliant OCR
c) Remove the Tif file once the PDF is created.

But sometimes, once the PDF file is created the JavaScript conde is not executed, and the Tif file remains in the space. This causes the next Tif File to be blocked for OCR and this situation overloads the processor and no TIF in the space is transformed to PDF until we delete manually the TIF file that caused this situation.

Anyone know why this might happen? Any ideas on how we can do this in a better way that avoids this situation?

Thanks a lot in advance

Outcomes