laravellaravel-4queueiron.io

Laravel 4 and Iron.io multiple queue / PHP


I started to take a look Iron.io as service for my queue process. With the easy set up in laravel I make it work in a couple of minutes but there is something that is not clear to me.

I subscribed a new queue called resizer using the artisan command as the following:

php artisan queue:subscribe resizer http://mywebsite.com/queue/resizer  

On the settings in the queue.php file I have to give the name on the key queue of the queue created in this case resizer

'iron' => array(
            'driver'  => 'iron',
            'host'    => 'mq-aws-us-east-1.iron.io',
            'token'   => 'xxxxxx',
            'project' => 'xxxx',
            'queue'   => 'resizer',
            'encrypt' => true,
        ),

But for sure I will have others kind of queues. This resizer queue is responsible to resize images, but I will have to set up another one for send email maybe called email.

Now let's say that I want implement the email queue and also have the resizer well i thought just subscribe another service.

 php artisan queue:subscribe email http://mywebsite.com/queue/email  

my routes:

Route::post('queue/resizer', function()
{
    Queue::marshal();
});

Route::post('queue/email', function()
{
    Queue::marshal();
});

Problem:

When I Hit the route queue/email Iron.io fire the resizer instead the email process adding 1 more message to that queue because on the settings I set up resizer. So how can I have different tasks / queue to assign to Iron.io each one for differents needs?


Solution

  • You can use pushRaw function

    pushRaw($payload, $queue = null, array $options = array())

    Example:

    Queue::pushRaw("This is Hello World payload", "email");