moleculer-cron
is the cron based scheduler service for Moleculer
The Install
$ npm install moleculer-cronjob --save
Usage
const ServiceBroker = const CronJob = // Create brokerconst broker = // Create my conjob servicebroker // Start brokerbrokerstart
The service uses settings as the cron.СronJob
constructor parameters, except for onTick
and onComplete
, for which the onTick
and onComplete
methods are used respectively.
The object returned by the cron.СronJob
constructor is stored in this.$cronjob
property, accessible everywhere within the service's context.
Cronjob stops automatically when the service is stopped, but can also be stopped manually.
const ServiceBroker = const CronJob = // Create brokerconst broker = // Create my conjob servicebroker // Start brokerbrokerstart
Test
$ npm test
In development with watching
$ npm run ci
Contribution
Please send pull requests improving the usage and fixing bugs, improving documentation and providing better examples, or providing some testing, because these things are important.
License
The project is available under the MIT license.
Contact
Copyright (c) 2019 Aleksandr Miroshnik
miroshnik@gmail.com