Worker/Job like a crontab

Hello,

I didnt find anything about that, so...

I want to aggregate a value inside the database each Xmin, is it possible to do a job like a crontab directly on database or should I create that cypher on my application?

Tks for the help

To my knowledge there's not a built in "task scheduler" in Neo4j. You can use existing scheduling programs like crontab to execute a script on a schedule.

Another idea is you could change it not to be time driven but event driven instead. You could have a database trigger to update aggregates when data changes. Or you could use the Kafka integration to publish an event that data has changed that would then start the process to come back down to update aggregates. Benefit of event driven workflow is you're not wasting compute cycles recalculating aggregates if nothing has changed since the last time.

You can use APOC to schedule background jobs.
If you would like to run a query periodically, then you can use this procedure:
apoc.periodic.repeat

More info:
call apoc.help("periodic")

N.B.: The documentation says there is a apoc.periodic.schedule, but it is wrong, it is the repeat procedure:
https://neo4j.com/docs/labs/apoc/4.1/background-operations/background-jobs/