cancel
Showing results for 
Search instead for 
Did you mean: 

People and group import scheduling

simon
Champ in-the-making
Champ in-the-making
Alfresco,

I can schedule the people and group import mechanism… let's say every 10 hours (default setting is every hour). We are importing + 1500 accounts every sync (with the clear all children option) and this is a time consuming operation.

This could be a problem when we schedule our hot backup, extensive write operations in the database are not the best moment to dump the tables.

Problem is that the current sync mechanism isn't very clear, it depends on the time Alfresco was started up (even without the backup this could be a performance issue).

Can I schedule this synchronization on a specific time (when I now the server load is low)?
5 REPLIES 5

andy
Champ on-the-rise
Champ on-the-rise
Hi Simon

We now support cron base triggers using org.alfresco.util.CronTriggerBean.

This should give you what you want. I will update the examples to use this soon.

Regards

Andy

simon
Champ in-the-making
Champ in-the-making
I will update the examples to use this soon.

That would be nice. Smiley Happy Thanks!

soeursourire
Champ in-the-making
Champ in-the-making
So if I well understand to use cron (for example when a user creates a person and decides that this person will be created in the database in 2days only I use a cron) the best way is to use this Alfresco class: CronTriggerBean ?

How should I use it exactly? Is there an example somewhere? in the code I did not find where this class is called?

For this cron we should define:
-a jobDetail with the name of the job to execute and the delay
-a jobDataMap with the parameters we need for our execution
-a class per execution to create the employee for example that will get the jobDataMap?
Is it correct? How is it done with CronTriggerBean?

Thanks in advance

simon
Champ in-the-making
Champ in-the-making
Here is an example of a cronbased trigger I use now (change this in the ldap-authentication-context.xml file):
<bean id="ldapGroupTrigger" class="org.alfresco.util.CronTriggerBean">
    <property name="jobDetail">
        <bean id="ldapGroupJobDetail" class="org.springframework.scheduling.quartz.JobDetailBean">
            <property name="jobClass">
                <value>org.alfresco.repo.importer.ImporterJob</value>
            </property>
            <property name="jobDataAsMap">
                <map>
                    <entry key="bean">
                        <ref bean="ldapGroupImport"/>
                    </entry>
                </map>
            </property>
        </bean>
    </property>

    <property name="scheduler">
        <ref bean="schedulerFactory" />
    </property>

    <property name="cronExpression">
        <value>0 40 6 * * ?</value> <!– daily at 06:40 –>
    </property>
</bean>
More information about the cronExpression can be found here in the forum.

soeursourire
Champ in-the-making
Champ in-the-making
Thanks a lot for your help.

Please tell me if I well understood:
I have a class that is creating a new user. If I want to use a cron when creating this user I should declare a bean newUserTrigger (like your ldapGroupTrigger) with properties to get the parameters I need. In your case, you have:
-ImporterJob that is your own class to define the job (name, delay…)
-ldapGroupImport that stores and give access to parameters needed
?
And the cron expression defines when the will be launched.
But then I need one bean per execution, one class ImporterJob and one ldapGroupImporter per job? And then as my user will not always be creating the same day (my users should be created for exemple the 10th of September 2006 at 8am or in 2weeks exactly…) so I will have to have a different bean each time?

Thanks again