Scheduler, Task and Cron – what to use where?

Enonic version: XP 7.7.0
OS: Ubuntu

Hey guys!

It’s not completely clear to me what the relationship between the new Scheduler library, TaskLibrary, and the Cron library is.

What problems does the new Scheduler library solve? Specially in a clustered environment.


I want to import data into a repo every night. I usually use Cron library for this, should I be using Scheduler library instead now?

– Tom Arild

My suggestion: Always use Scheduler and the new submitTask :slight_smile:

Then you as a developer shouldn’t have to think about cluster issues.

The cron library works locally per cluster node.
Scheduler is cluster wide.

I could say a lot more about libCron issues, but now that we have better tools, why explain the old…


Cron-library is obsolete. Lib-scheduler replaces its functionality (and adds a bunch of new features and improvements). Lib-scheduler however requires XP >= 7.7

1 Like

May I suggest that you document this both in the documentation for lib-cron and in the README.adoc for lib-cron.

I tried to document this in enonic-types now, but I’m not completely sure if it will show up in peoples IDEs.

Not so fast…
lib-cron may still useful in some cases.

  1. lib-scheduler has only 1 minute granularity at best. lib-cron can schedule with sub-second precision.
  2. lib-scheduler can only execute named tasks, lib-cron can run any code.
  3. lib-scheduler is designed to run task "somewhere in the cluster and exclusively on one node. lib-cron runs everywhere and may clean, for instance, XP node local caches periodically

That seems to summarise - lib scheduler for most use-cases, lib-cron for special low-level use-cases.