Is there any documentation or tutorial?

Created on 21 June 2023, about 1 year ago
Updated 22 July 2023, 11 months ago

Problem/Motivation

New to queue api. I am creating queues using the basic core api, but I have a project where I need to queue 3,000+ items. Would like an interface which gives me a better picture of the process. Also need more control over how many items are processed and how often.

Steps to reproduce

I installed Advanced Queue. Haven't a clue how to configure and use it as I can't find any documentation.

Proposed resolution

Where is the documentation, or a tutorial on how to use?

πŸ’¬ Support request
Status

Fixed

Component

Documentation

Created by

πŸ‡ΊπŸ‡ΈUnited States SomebodySysop

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @SomebodySysop
  • πŸ‡ΊπŸ‡ΈUnited States SomebodySysop

    I actually figured out some stuff using ChatGPT.

    However, I'd like to know how to create a queue programmatically. I created one in the UI. I've been trying to determine from Query.php how to do the same programmatically, but no luck so far.

    This is what I have:

    // Get the entity type manager service.
    $entity_type_manager = \Drupal::entityTypeManager();
    
    // Create the queue.
    $queue = $entity_type_manager->getStorage('advancedqueue_queue')->create([
      'id' => 'batchembed',
      'label' => 'BatchEmbed',
      'backend' => 'database',
      'backend_configuration' => [],
      'lease_time' => 300, // 300 seconds
      'processor' => 'cron',
      'processing_time' => 2700, // 2700 seconds
      'remove_finished_jobs' => ADVANCEDQUEUE_REMOVE_FINISHED_JOBS_DAYS,
      'remove_finished_jobs_value' => 7, // 7 days
      'remove_finished_jobs_state' => ADVANCEDQUEUE_JOB_STATE_SUCCESS,
    ]);
    
    // Save the queue.
    $queue->save();
    

    What am I missing?

  • Status changed to Needs review 12 months ago
  • πŸ‡«πŸ‡·France fgm Paris, France

    You were not far, but the options are not exactly those ones, and the constants do not exist, they look like ChatGPT hallucinations:

    use Drupal\advancedqueue\Entity\QueueInterface;
    use Drupal\advancedqueue\Job;
    
    $etm = \Drupal::entityTypeManager();
    $storage = $etm->getStorage('advancedqueue_queue');
    
    $q = $storage->create([
      'id' => 'batchembed',
      'label' => 'BatchEmbed',
      'backend' => 'database',
      'backend_configuration' => ['lease_time' => 300],
      'processor' => QueueInterface::PROCESSOR_CRON,
      'processing_time' => 2700,
      'threshold' => [
        'type' => QueueInterface::QUEUE_THRESHOLD_DAYS,
        'limit' => 7,
        'state' => Job::STATE_SUCCESS,
      ],
      'locked' => FALSE,
    ]);
    $queue->save();
    
  • πŸ‡ΊπŸ‡ΈUnited States SomebodySysop

    Thank you!

  • Status changed to Fixed 12 months ago
  • πŸ‡«πŸ‡·France fgm Paris, France
  • Automatically closed - issue fixed for 2 weeks with no activity.

  • Status changed to Fixed 11 months ago
  • πŸ‡«πŸ‡·France fgm Paris, France
Production build 0.69.0 2024