This is the second tutorial in a 3-Part series. If you haven’t completed the first tutorial 1, I would recommend going through it first here.
Create a CRON job to be executed at 12 am every day
In this step, we will register a CRON job that executes at 12 am every day. This CRON job will simply console log the time of execution and a static message.
Step 1
Add a new QUEUE_NAME called MIDNIGHT_CRON
Step 2
Add a new processor for CRON
Step 3
Register the CRON job in the server/utils/queue.js
We will invoke the initQueues method from the server/index.js to initialize the queues on startup. After initializing the queues we will add a CRON job to be executed at 12 am.
You should see the below logs at 12 am!
🚀Feel free to update the regex and execute the CRON sooner than 12 am to test how it works.

Commit your code using the following git commands
Loved the tutorial? There's more where that came from at LeadReads. Join top C Execs in gaining exclusive insights and real-world digital product stories.
Join here.
Where to go from here
You now have the ability to set up CRON jobs in a multi-container environment.
I hope you enjoyed reading this article as much as I enjoyed writing it. If this piqued your interest stay tuned for the next article in the series where I will take you through how to write GraphQL subscriptions in a multi-container environment using graphql-redis-subscriptions
If you have any questions or comments, please join the forum discussion on Twitter.