I am developing a custom AIO extension (SDK 3.0.1, Alfresco Community 5.2) that handles Node when it is being created based on Policy Component Bahaviour:
new JavaBehaviour(this, "onCreateNode",
In onCreateMethod created file is posted to external service. Since the processing of this file in external service can take a long time I get a timeout in Share in upload file dialog.
I tried a workaround to run a method that posts new file to external service in a new thread but this clearly does not work due to transaction management and it fails with following exceptions:
"Thread-29" org.alfresco.error.AlfrescoRuntimeException: 11140019 Transaction must be active and synchronization is required: Thread[Thread-29,5,main]
"Thread-30" org.alfresco.service.cmr.repository.InvalidNodeRefException: Node does not exist: workspace://SpacesStore/f9e3d633-33ba-443b-811c-b3781d3f8f22 (status:null)
I don't want to block a User with longer timeout. Is there a way to allow a file to be uploaded and then run posting it to external service in the background/async? Does anybody have a working example or a suggestion what is the most optimal way to perform such tasks?
Thank you in advance,