CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion »
  • 5.0 Saloon »
  • Queues and Spooler
Pages: [1]

Author Topic: Queues and Spooler  (Read 1100 times)

JoeMurray

  • Administrator
  • Ask me questions
  • *****
  • Posts: 578
  • Karma: 24
    • JMA Consulting
  • CiviCRM version: 4.4 and 4.5 (as of Nov 2014)
  • CMS version: Drupal, WordPress, Joomla
  • MySQL version: MySQL 5.5, 5.6, MariaDB 10.0 (as of Nov 2014)
Queues and Spooler
May 18, 2014, 06:58:17 am
I'm wanting feedback on continuing with use of internally developed spooler for asynchronous bulk outbound processing, versus creating a dependency on a Doctrine bundle.

CiviCRM currently has a fairly simple spooler at CRM_Mailing_BAO_Spool::send, with the asynchronous sending of emails handled by the Send Scheduled Mailings scheduled job. CRM_SMS_Form::postProcess also calls into CRM_Mailing_BAO_Mailing::create so it also uses this spooler.

As part of work on Phone Integration we will need to have functionality to spool and asynchronously deliver Voice Broadcast messages. Down the road we will also want to spool more complex interactive voice response (IVR) calls eg to get people to respond to CiviSurvey questions without needing an operator.

Looking at http://knpbundles.com/keyword/queue I see lots of options for bundles that provide queuing for work jobs to be run asynchronously. Many integrate with well-maintained high quality services: RabbitMQ, redis, beanstalkd. Most of them require some sort of package management to install a daemon that would effectively replicate what we are doing with Drupal cron. Some like queue provide a thin layer that allows allow various services to be substituted under the interface.

There are other sorts of functionality that could benefit from asynchronous jobs besides those currently setup as scheduled jobs. Long running imports are the one I think about most - Salesforce does imports this way, sending completion notices out when done.

Any feedback on creating a dependency on queue or an equivalent? I think it would be useful if we implemented our own spooler and scheduled job that did not require installation of any package on servers with restricted access. For installations with higher end needs and greater sysadmin privileges, the external packages could provide scalability, failover, etc. Once this is working for phone blasts, the mailing spool could be refactored to take advantage of the same approach. But this is maybe over-engineering.

Feedback?

Co-author of Using CiviCRM https://www.packtpub.com/using-civicrm/book

totten

  • Administrator
  • Ask me questions
  • *****
  • Posts: 695
  • Karma: 64
Re: Queues and Spooler
May 19, 2014, 11:51:51 am
a) I do like the idea of introducing a 3rd-party queuing library with support for multiple queue providers.

b) Currently, 5.0 includes a handful of Symfony Components, but it's not using the full AppKernel from Symfony SE. Getting 3rd-party Symfony Bundles to load today would be non-trivial.

c) Civi has internally had an abstract queue interface since v4.2 (IIRC). It includes two queue implementations ("Memory" and "Sql") which store queue items in PHP's memory or a SQL table ("civicrm_queue_item") [respectively]. By design, the interface lines up with Drupal 7's Queue API. (D7 has more queue providers implemented -- there's some hope for borrowing those, but that's also non-trivial.) Some interesting links:

 - The queue interface: https://github.com/civicrm/civicrm-core/blob/master/CRM/Queue/Queue.php
 - Docblock comments on using it: https://github.com/civicrm/civicrm-core/blob/master/CRM/Queue/Service.php#L28
 - Example of putting tasks in a queue and running them with a web-based progress bar: https://github.com/civicrm/civicrm-core/blob/master/tools/extensions/org.civicrm.demoqueue/CRM/Demoqueue/Page/DemoQueue.php

JoeMurray

  • Administrator
  • Ask me questions
  • *****
  • Posts: 578
  • Karma: 24
    • JMA Consulting
  • CiviCRM version: 4.4 and 4.5 (as of Nov 2014)
  • CMS version: Drupal, WordPress, Joomla
  • MySQL version: MySQL 5.5, 5.6, MariaDB 10.0 (as of Nov 2014)
Re: Queues and Spooler
May 21, 2014, 12:47:48 pm
Thanks alot. For now we will just use the core queue implementation, though we may get keen and refactor civimail to use too.
Co-author of Using CiviCRM https://www.packtpub.com/using-civicrm/book

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion »
  • 5.0 Saloon »
  • Queues and Spooler

This forum was archived on 2017-11-26.