SlideShare a Scribd company logo
Introduction to Cron Queue 
Olga Smolyankina
300 FOR ALL
Introduction to cron queue
Introduction to cron queue
Introduction to cron queue
Run methods 
cron.php 
Ultimate Cron 
Elysia Cron 
.crontab 
.crontab 
drush queue-cron 
modules/drupal_queue_cron.php
Usage cases 
● Entity items creation. 
● Sending emails. 
● Other mass operations.
Usage cases
How To. Add Queue Items 
$queue = DrupalQueue::get('queue_name'); 
$queue->createQueue(); 
$queue->createItem(array( 
'key1' => $value1, 
'key2' => $value2, 
... 
hook_cron() 
)); API hook_node_insert($node) 
hook_user_insert(&$edit, $account, $category) 
hook_commerce_cart_order_empty($order) 
...
How To. Add Queue Items 
/** 
* Implements hook_cronapi(). 
*/ 
function mymodule_queue_cronapi($op, $job = NULL) { 
$items = array(); 
$items['add_queue_items'] = array( 
'rule' => '0 5 * * *', 
'arguments' => array(), 
API 
'callback' => 'add_queue_items_callback', 
); 
● Elysia Cron 
return $items; 
}
How To. Implementation 
/** 
* Implements hook_cron_queue_info(). 
*/ 
function mymodule_cron_queue_info() { 
$queues = array(); 
$queues['queue_name'] = array( 
'worker callback' => '_mymodule_queue_worker_callback', 
'time' => 90, 
'skip on cron' => FALSE, 
); 
return $queues; 
}
How To. Process Queue Items 
system.queue.inc 
DrupalQueueInterface::createQueue(); 
DrupalQueueInterface::deleteQueue(); 
DrupalQueueInterface::createItem($data); 
DrupalQueueInterface::claimItem($lease_time = 3600); 
DrupalQueueInterface::releaseItem($item); 
DrupalQueueInterface::deleteItem($item); 
DrupalQueueInterface::numberOfItems();
Queue Run Tracking 
● Queue UI 
● Ultimate Cron
Negatives
Negatives vs Features 
● Cron run frequency. 
● Cron run duration. 
● Cron run propriety. 
● Item locking => single cron job at once. 
● Queue decoupled from the code => external queue run!
Thank you!

More Related Content

What's hot (20)

PDF
Nickolay Shmalenuk.Render api eng.DrupalCamp Kyiv 2011
camp_drupal_ua
 
PDF
Building Real Time Systems on MongoDB Using the Oplog at Stripe
MongoDB
 
PDF
Building Real Time Systems on MongoDB Using the Oplog at Stripe
Stripe
 
PDF
Grails 1.2 探検隊 -新たな聖杯をもとめて・・・-
Tsuyoshi Yamamoto
 
PDF
The Beauty Of Java Script V5a
rajivmordani
 
PDF
Twib in Yokoahma.pm 2010/3/5
Yusuke Wada
 
PDF
エロサイト管理者の憂鬱3 - Hokkaiodo.pm#4 -
Yusuke Wada
 
PDF
The Beauty of Java Script
Michael Girouard
 
PDF
How I started to love design patterns
Samuel ROZE
 
KEY
jQuery Namespace Pattern
Diego Fleury
 
PDF
Nubilus Perl
Flavio Poletti
 
KEY
Perl Web Client
Flavio Poletti
 
PDF
Introduction to CQRS and Event Sourcing
Samuel ROZE
 
PDF
Debugging JavaScript with Chrome
Igor Zalutsky
 
PDF
Perl6 operators and metaoperators
Simon Proctor
 
PDF
Decoupling Objects With Standard Interfaces
Thomas Weinert
 
PDF
PerlでWeb API入門
Yusuke Wada
 
PPT
Ruby on Rails Intro
zhang tao
 
PDF
News of the Symfony2 World
Fabien Potencier
 
PDF
Frege is a Haskell for the JVM
jwausle
 
Nickolay Shmalenuk.Render api eng.DrupalCamp Kyiv 2011
camp_drupal_ua
 
Building Real Time Systems on MongoDB Using the Oplog at Stripe
MongoDB
 
Building Real Time Systems on MongoDB Using the Oplog at Stripe
Stripe
 
Grails 1.2 探検隊 -新たな聖杯をもとめて・・・-
Tsuyoshi Yamamoto
 
The Beauty Of Java Script V5a
rajivmordani
 
Twib in Yokoahma.pm 2010/3/5
Yusuke Wada
 
エロサイト管理者の憂鬱3 - Hokkaiodo.pm#4 -
Yusuke Wada
 
The Beauty of Java Script
Michael Girouard
 
How I started to love design patterns
Samuel ROZE
 
jQuery Namespace Pattern
Diego Fleury
 
Nubilus Perl
Flavio Poletti
 
Perl Web Client
Flavio Poletti
 
Introduction to CQRS and Event Sourcing
Samuel ROZE
 
Debugging JavaScript with Chrome
Igor Zalutsky
 
Perl6 operators and metaoperators
Simon Proctor
 
Decoupling Objects With Standard Interfaces
Thomas Weinert
 
PerlでWeb API入門
Yusuke Wada
 
Ruby on Rails Intro
zhang tao
 
News of the Symfony2 World
Fabien Potencier
 
Frege is a Haskell for the JVM
jwausle
 

Similar to Introduction to cron queue (20)

PDF
Lazy evaluation drupal camp moscow 2014
Evgeny Nikitin
 
ODP
Drupal 7 Queues
Philip Norton
 
PDF
Migrare da symfony 1 a Symfony2
Massimiliano Arione
 
PDF
Doctrine For Beginners
Jonathan Wage
 
PDF
Ten useful JavaScript tips & best practices
Ankit Rastogi
 
PPTX
Php on the desktop and php gtk2
Elizabeth Smith
 
PDF
Introduction to Zend Framework web services
Michelangelo van Dam
 
PDF
50 Laravel Tricks in 50 Minutes
Azim Kurt
 
PDF
laravel tricks in 50minutes
Barang CK
 
KEY
Zend framework service
Michelangelo van Dam
 
KEY
Zend framework service
Michelangelo van Dam
 
PDF
Digital Mayflower - Data Pilgrimage with the Drupal Migrate Module
Erich Beyrent
 
PDF
CGI::Prototype (NPW 2006)
brian d foy
 
PDF
Drupal 8: Routing & More
drubb
 
KEY
Symfony2 Building on Alpha / Beta technology
Daniel Knell
 
PPTX
Taming that client side mess with Backbone.js
Jarod Ferguson
 
PDF
Drush - use full power - DrupalCamp Donetsk 2014
Alex S
 
PDF
Drush - use full power - Alexander Schedrov
DrupalCampDN
 
PDF
Be RESTful (Symfony Camp 2008)
Fabien Potencier
 
PPTX
Drupal 8 migrate!
Pavel Makhrinsky
 
Lazy evaluation drupal camp moscow 2014
Evgeny Nikitin
 
Drupal 7 Queues
Philip Norton
 
Migrare da symfony 1 a Symfony2
Massimiliano Arione
 
Doctrine For Beginners
Jonathan Wage
 
Ten useful JavaScript tips & best practices
Ankit Rastogi
 
Php on the desktop and php gtk2
Elizabeth Smith
 
Introduction to Zend Framework web services
Michelangelo van Dam
 
50 Laravel Tricks in 50 Minutes
Azim Kurt
 
laravel tricks in 50minutes
Barang CK
 
Zend framework service
Michelangelo van Dam
 
Zend framework service
Michelangelo van Dam
 
Digital Mayflower - Data Pilgrimage with the Drupal Migrate Module
Erich Beyrent
 
CGI::Prototype (NPW 2006)
brian d foy
 
Drupal 8: Routing & More
drubb
 
Symfony2 Building on Alpha / Beta technology
Daniel Knell
 
Taming that client side mess with Backbone.js
Jarod Ferguson
 
Drush - use full power - DrupalCamp Donetsk 2014
Alex S
 
Drush - use full power - Alexander Schedrov
DrupalCampDN
 
Be RESTful (Symfony Camp 2008)
Fabien Potencier
 
Drupal 8 migrate!
Pavel Makhrinsky
 
Ad

More from ADCI Solutions (15)

PDF
Drupal front-end performance
ADCI Solutions
 
PDF
Drupal. Advantages and disadvantages. Igor Rodionov.
ADCI Solutions
 
PDF
Drupal theming must knows. Kate Kalashnikova.
ADCI Solutions
 
PDF
Drupal. History and Future. Sergey Susikov.
ADCI Solutions
 
PDF
Data Import From the Server of The Central Bank of the Russian Federation: Ho...
ADCI Solutions
 
PDF
Drupal 8: What's new? Anton Shubkin
ADCI Solutions
 
PDF
Contextly. Dmitry Tartynov
ADCI Solutions
 
PDF
Vagrant. Halturin Artem
ADCI Solutions
 
PDF
Must-knows and common mistakes in theming. Kate Kalashnikova.
ADCI Solutions
 
PDF
Drupal 8. Movement towards. Susikov Sergey
ADCI Solutions
 
PDF
Upgrade with 6 to 7. Denis Komel'kov
ADCI Solutions
 
PDF
Responsive website building approach. Olga Smolyankina and Kate Kalashnikova
ADCI Solutions
 
PDF
Entity. Anton Shubkin and Yaroslav Ponomarev
ADCI Solutions
 
PDF
LESS and even more. Anton Shubkin.
ADCI Solutions
 
PDF
Selenium. Stas Kuzminov
ADCI Solutions
 
Drupal front-end performance
ADCI Solutions
 
Drupal. Advantages and disadvantages. Igor Rodionov.
ADCI Solutions
 
Drupal theming must knows. Kate Kalashnikova.
ADCI Solutions
 
Drupal. History and Future. Sergey Susikov.
ADCI Solutions
 
Data Import From the Server of The Central Bank of the Russian Federation: Ho...
ADCI Solutions
 
Drupal 8: What's new? Anton Shubkin
ADCI Solutions
 
Contextly. Dmitry Tartynov
ADCI Solutions
 
Vagrant. Halturin Artem
ADCI Solutions
 
Must-knows and common mistakes in theming. Kate Kalashnikova.
ADCI Solutions
 
Drupal 8. Movement towards. Susikov Sergey
ADCI Solutions
 
Upgrade with 6 to 7. Denis Komel'kov
ADCI Solutions
 
Responsive website building approach. Olga Smolyankina and Kate Kalashnikova
ADCI Solutions
 
Entity. Anton Shubkin and Yaroslav Ponomarev
ADCI Solutions
 
LESS and even more. Anton Shubkin.
ADCI Solutions
 
Selenium. Stas Kuzminov
ADCI Solutions
 
Ad

Recently uploaded (20)

PDF
TrustArc Webinar - Data Privacy Trends 2025: Mid-Year Insights & Program Stra...
TrustArc
 
PDF
Are there government-backed agri-software initiatives in Limerick.pdf
giselawagner2
 
PDF
Novus Safe Lite- What is Novus Safe Lite.pdf
Novus Hi-Tech
 
PDF
Smart Air Quality Monitoring with Serrax AQM190 LITE
SERRAX TECHNOLOGIES LLP
 
PDF
Ampere Offers Energy-Efficient Future For AI And Cloud
ShapeBlue
 
PPTX
UiPath Academic Alliance Educator Panels: Session 2 - Business Analyst Content
DianaGray10
 
PDF
Human-centred design in online workplace learning and relationship to engagem...
Tracy Tang
 
PPTX
Building Search Using OpenSearch: Limitations and Workarounds
Sease
 
PDF
CloudStack GPU Integration - Rohit Yadav
ShapeBlue
 
PPTX
Building and Operating a Private Cloud with CloudStack and LINBIT CloudStack ...
ShapeBlue
 
PPTX
Top Managed Service Providers in Los Angeles
Captain IT
 
PDF
Why Orbit Edge Tech is a Top Next JS Development Company in 2025
mahendraalaska08
 
PDF
HR agent at Mediq: Lessons learned on Agent Builder & Maestro by Tacstone Tec...
UiPathCommunity
 
PDF
Productivity Management Software | Workstatus
Lovely Baghel
 
PPTX
MSP360 Backup Scheduling and Retention Best Practices.pptx
MSP360
 
PDF
Empowering Cloud Providers with Apache CloudStack and Stackbill
ShapeBlue
 
PDF
Novus-Safe Pro: Brochure-What is Novus Safe Pro?.pdf
Novus Hi-Tech
 
PDF
Complete JavaScript Notes: From Basics to Advanced Concepts.pdf
haydendavispro
 
PDF
Apache CloudStack 201: Let's Design & Build an IaaS Cloud
ShapeBlue
 
PDF
Arcee AI - building and working with small language models (06/25)
Julien SIMON
 
TrustArc Webinar - Data Privacy Trends 2025: Mid-Year Insights & Program Stra...
TrustArc
 
Are there government-backed agri-software initiatives in Limerick.pdf
giselawagner2
 
Novus Safe Lite- What is Novus Safe Lite.pdf
Novus Hi-Tech
 
Smart Air Quality Monitoring with Serrax AQM190 LITE
SERRAX TECHNOLOGIES LLP
 
Ampere Offers Energy-Efficient Future For AI And Cloud
ShapeBlue
 
UiPath Academic Alliance Educator Panels: Session 2 - Business Analyst Content
DianaGray10
 
Human-centred design in online workplace learning and relationship to engagem...
Tracy Tang
 
Building Search Using OpenSearch: Limitations and Workarounds
Sease
 
CloudStack GPU Integration - Rohit Yadav
ShapeBlue
 
Building and Operating a Private Cloud with CloudStack and LINBIT CloudStack ...
ShapeBlue
 
Top Managed Service Providers in Los Angeles
Captain IT
 
Why Orbit Edge Tech is a Top Next JS Development Company in 2025
mahendraalaska08
 
HR agent at Mediq: Lessons learned on Agent Builder & Maestro by Tacstone Tec...
UiPathCommunity
 
Productivity Management Software | Workstatus
Lovely Baghel
 
MSP360 Backup Scheduling and Retention Best Practices.pptx
MSP360
 
Empowering Cloud Providers with Apache CloudStack and Stackbill
ShapeBlue
 
Novus-Safe Pro: Brochure-What is Novus Safe Pro?.pdf
Novus Hi-Tech
 
Complete JavaScript Notes: From Basics to Advanced Concepts.pdf
haydendavispro
 
Apache CloudStack 201: Let's Design & Build an IaaS Cloud
ShapeBlue
 
Arcee AI - building and working with small language models (06/25)
Julien SIMON
 

Introduction to cron queue

  • 1. Introduction to Cron Queue Olga Smolyankina
  • 6. Run methods cron.php Ultimate Cron Elysia Cron .crontab .crontab drush queue-cron modules/drupal_queue_cron.php
  • 7. Usage cases ● Entity items creation. ● Sending emails. ● Other mass operations.
  • 9. How To. Add Queue Items $queue = DrupalQueue::get('queue_name'); $queue->createQueue(); $queue->createItem(array( 'key1' => $value1, 'key2' => $value2, ... hook_cron() )); API hook_node_insert($node) hook_user_insert(&$edit, $account, $category) hook_commerce_cart_order_empty($order) ...
  • 10. How To. Add Queue Items /** * Implements hook_cronapi(). */ function mymodule_queue_cronapi($op, $job = NULL) { $items = array(); $items['add_queue_items'] = array( 'rule' => '0 5 * * *', 'arguments' => array(), API 'callback' => 'add_queue_items_callback', ); ● Elysia Cron return $items; }
  • 11. How To. Implementation /** * Implements hook_cron_queue_info(). */ function mymodule_cron_queue_info() { $queues = array(); $queues['queue_name'] = array( 'worker callback' => '_mymodule_queue_worker_callback', 'time' => 90, 'skip on cron' => FALSE, ); return $queues; }
  • 12. How To. Process Queue Items system.queue.inc DrupalQueueInterface::createQueue(); DrupalQueueInterface::deleteQueue(); DrupalQueueInterface::createItem($data); DrupalQueueInterface::claimItem($lease_time = 3600); DrupalQueueInterface::releaseItem($item); DrupalQueueInterface::deleteItem($item); DrupalQueueInterface::numberOfItems();
  • 13. Queue Run Tracking ● Queue UI ● Ultimate Cron
  • 15. Negatives vs Features ● Cron run frequency. ● Cron run duration. ● Cron run propriety. ● Item locking => single cron job at once. ● Queue decoupled from the code => external queue run!