Saturday, 12 April 2014

Running action asynchronously in alfresco

Hello everyone !

We all are aware that we can set up business rules to run asynchronously.
Consider a scenario, wherein you don't have a business rule setup. However, you need to run the functionality through an action  (Invoked using View Details > Run Action) and this action is
processing around thousands of records. 
If you don't run this action in background, you may have to end-up waiting on the same screen (from where you invoked the action) until the action execution completes.
and you can not do anyother activities in the alfresco webclient until then.
There is a way where in we can have the actions run asynchronously through some customization.
Below is the implementation detail about it in brief.
1. For all the actions invoked from View Details > Run Action link, is the backend wizard been for run action wizard.
2. In FinishImpl method, action is invoked as below.
   this.getActionService().executeAction(action, nodeRef);
3. Modify it as below to run it as asynchronously. You can make it conditional to have it run asynchronously explicitly for your action.
   this.getActionService().executeAction(action, nodeRef, false, true);
Hope this will be useful to you.
Ramesh C

No comments:

Post a Comment