Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Resque Webui Bundle Laravel Package

andaris/resque-webui-bundle

View on GitHub
Deep Wiki
Context7

Getting Started

Minimal Setup

  1. Install the Bundle
    composer require andaris/resque-webui-bundle
    
  2. Register the Bundle Add to AppKernel.php (or src/Kernel.php):
    new Andaris\ResqueWebUiBundle\AndarisResqueWebUiBundle(),
    
  3. Configure Security Restrict access in security.yml:
    access_control:
        - { path: ^/resque, roles: ROLE_ADMIN }
    
  4. Enable Routing Add to routing.yml:
    resque:
        resource: "@AndarisResqueWebUiBundle/Resources/config/routing.yml"
        prefix: /resque/
    
  5. First Use Case Access /resque to view:
    • Running workers (like bin/resque workers).
    • Queue status (like bin/resque queues).
    • Job details with JSON payloads for debugging.

Implementation Patterns

Workflows

  1. Monitoring Jobs

    • Use the Queues tab to track job backlogs and delays.
    • Filter by queue name or priority to isolate issues.
  2. Debugging Failed Jobs

    • Navigate to the Jobs tab, filter by failed status.
    • Click a job to inspect its payload, logs, or retry it directly.
  3. Worker Management

    • Check the Workers tab to verify active workers and their queues.
    • Restart workers via the UI if stuck (if configured with resque:restart command).
  4. Integration with Laravel

    • Service Provider: Bind Resque to Laravel’s container in AppServiceProvider:
      $this->app->bind('resque', function () {
          return new \Resque();
      });
      
    • Job Dispatch: Use Laravel’s queue system to push jobs to Resque:
      dispatch(new MyJob)->onQueue('critical');
      
    • Event Listeners: Hook into Resque events (e.g., resque.job.failed) via Laravel’s event system.
  5. Customizing Views

    • Override templates in app/Resources/AndarisResqueWebUiBundle/views/ to modify UI behavior.
    • Extend CSS/JS by overriding assets in web/bundles/andarisresquewebui/.
  6. API Access

    • Use the underlying php-resque API for programmatic access:
      $job = Resque::job(123); // Fetch job by ID
      $job->payload(); // Get raw payload
      

Integration Tips

  • Laravel Queues: Ensure php-resque is configured in config/queue.php:
    'connections' => [
        'resque' => [
            'driver' => 'resque',
            'queue' => 'default',
            'timeout' => 120,
        ],
    ],
    
  • Redis Connection: Verify Redis is running and accessible:
    $resque = new \Resque();
    $resque->setBackend('tcp://127.0.0.1:6379');
    
  • Cron Jobs: Schedule worker restarts or queue checks via Laravel’s schedule:run or cron.

Gotchas and Tips

Pitfalls

  1. Redis Misconfiguration

    • Issue: Jobs disappear or workers fail silently if Redis isn’t running or is misconfigured.
    • Fix: Verify Redis connection in php-resque config:
      $resque = new \Resque();
      $resque->setBackend('tcp://host:port');
      
    • Debug: Check Redis logs or use redis-cli to test connectivity.
  2. Permission Denied

    • Issue: 403 errors if security.yml roles aren’t assigned to users.
    • Fix: Ensure users have the required role (e.g., ROLE_ADMIN) in your auth system.
  3. Job Payload Size Limits

    • Issue: Large payloads may break the UI’s JSON display.
    • Fix: Use json_encode($job->payload(), JSON_PRETTY_PRINT) in custom templates or truncate payloads.
  4. Worker Stuck in "Busy" State

    • Issue: Workers appear stuck but aren’t processing jobs.
    • Fix: Restart workers via:
      php bin/console resque:restart
      
      Or manually kill and restart them.
  5. Routing Conflicts

    • Issue: /resque conflicts with other routes.
    • Fix: Change the prefix in routing.yml or use a unique path:
      prefix: /admin/resque/
      

Debugging

  • Log Worker Errors: Enable Resque logging in config/packages/resque_web_ui.yaml:
    resque_web_ui:
        log_errors: true
    
  • Check Redis Keys: Use redis-cli KEYS resque:* to inspect job/queue keys manually.
  • Disable Cache: Clear Symfony cache if UI changes aren’t reflected:
    php bin/console cache:clear
    

Extension Points

  1. Custom Job Actions

    • Extend the JobController to add buttons (e.g., "Replay" or "Archive"):
      // src/Controller/ResqueJobController.php
      public function replayAction($queue, $jobId) {
          $job = Resque::job($jobId);
          Resque::enqueue($queue, $job->payload());
          return $this->redirect($this->generateUrl('resque_jobs'));
      }
      
    • Update the job template to include the new button.
  2. Add Metrics

    • Integrate with Laravel’s laravel-debugbar or spatie/laravel-metrics to display Resque stats.
  3. Theming

    • Override Bootstrap themes by extending the bundle’s assets:
      // web/css/andaris-resque-webui.scss
      @import "~andaris/resque-webui-bundle/Resources/public/css/app.scss";
      .resque-ui { background: #f0f0f0; }
      
  4. API Endpoints

    • Expose Resque data via Laravel’s API routes:
      # config/routes.yaml
      resque_api:
          path: /api/resque/workers
          controller: Andaris\ResqueWebUiBundle\Controller\ResqueWorkerController::apiListAction
      

Configuration Quirks

  • Queue Prefix: If using a custom Redis prefix (e.g., laravel:), configure it in php-resque:
    $resque = new \Resque();
    $resque->setBackend('tcp://host:port', 'laravel:');
    
  • Worker Timeout: Adjust worker timeout in config/packages/resque_web_ui.yaml:
    resque_web_ui:
        worker_timeout: 300 # 5 minutes
    
  • Job Retry Limits: Override default retry logic in a custom job class:
    class MyJob implements \Resque\Job {
        public function perform() { /* ... */ }
        public function onFail() { /* Custom fail logic */ }
    }
    
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
milito/query-filter
apiboxsym/user-bundle
apiboxsym/health-check-bundle
jayeshmepani/jpl-moshier-ephemeris-php
elnasnato/laraliveui
labrodev/rest-sdk
sampaui/sampaui
babelqueue/php-sdk
facebook/capi-param-builder-php
babelqueue/symfony
hamzi/corewatch
minionfactory/raw-hydrator
hexters/coinpayment
rjcodes/rjcms
act-training/laravel-permissions-manager
alimarchal/laravel-chart-of-accounts
babenkoivan/elastic-scout-driver
mkwebdesign/filament-watchdog-v5
renatomarinho/laravel-page-speed
zedmagdy/filament-business-hours