cancel
Showing results for 
Search instead for 
Did you mean: 

Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.

Worker/Job like a crontab

natamvo
Node Link

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

2 REPLIES 2

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.

szenyo
Node Clone

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/

Nodes 2022
Nodes
NODES 2022, Neo4j Online Education Summit

All the sessions of the conference are now available online