How to make the "documentCreated" event waiting for a blob to be attached before processing

Hello,

I want to handle routing for documents according to the name of the file they are carrying.

What I done is:

Trigger the creation of a document on the repository with httpAutomationClient when a file is created on the client side AND THEN attach blob to this document

This part works (my file is finding its way to the nuxeo platform)

In the target folder i attached a listener as when a document is created, it's moved to a particuliar target according to it's name.

The problem is as it's configured to be launched for each “documentCreated” event, my blob attach operation is failing as the document is moved and what I get at the end is an empty document :(

Is there a way to ensure there's no more blob attach operation pending on the document before moving it ? Kind of lock or something ?

Thanks and thanks again

Antoine

0 votes

1 answers

970 views

ANSWER

Can you tell us what is your "create-document" event that is raised? Where?

I'd say implementing a listener triggered when documentUpdate event is raised and checking if the blob is attached or not.

11/27/2013

Thank you! triggering the listener on the documentModified event was what i needed :)
11/28/2013



As mentioned in comments documentModified event allows to trigger the operation when the blob is attached rather than when the document is created.

1 votes



Nice! And yes sorry for the mistake "documentUpdate" wrong name;)
11/28/2013

Same mistake here with the documentCreated designation. I fixed it for posterity, have a nice day.
11/28/2013