cancel
Showing results for 
Search instead for 
Did you mean: 

Scheduled Job

lascaux
Champ on-the-rise
Champ on-the-rise
Hi,

I would like to create some scheduled job which will call a javascript …

I would like to do the following :

1) every x minutes, check in a specific space if some documents have a specific value for a property.
2) call a JS script that will perform some tasks on the documents found by the search.


My questions are :
1) is it possible ?
2) Do I need to perform the search in the JS script or in the <bean id="runScript" class="org.alfresco.repo.action.scheduled.CronScheduledQueryBasedTemplateActionDefinition">
in the "queryTemplate" property ?
3) if the search is performed by the scheduled job, how the script could get the "result" of the search ?

Thanks for your reply

Sylvain
3 REPLIES 3

kevinr
Star Contributor
Star Contributor
Hello,

1) Yes
2) You can perform the search in JS yes - there is no overhead to this. You just use the cron job based rule timer to launch the script at the appropriate time.
3) It can't usefully, so option (2) is best.

Thanks,

Kevin

lascaux
Champ on-the-rise
Champ on-the-rise
Thanks a lot …

In term of performance, what is the impact of running a scheduled job(s) that call javascript ?

Is it better to develop a Job on the server itselft that access to the Web Service to perform the same actions ?

kevinr
Star Contributor
Star Contributor
The impact will depend on what actions you take in the javascript code - there is no significant overhead using a cron job rule that executes javascript. From what you are suggesting doing, I expect the Lucene query that you execute and walking of the result nodes will be the performance hit - and that depends on the complexity of your search and number of results.

Thanks,

Kevin