2

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?

Fabrizio Fenoglio
  • 5,767
  • 14
  • 38
  • 75

1 Answers1

3

You can use pushRaw function

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

Example:

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

Dmitriy
  • 399
  • 2
  • 6
  • Thanks for you kind answer, can you be a bit more specific please. I never used this method, it need to be used on the route instead `Queue::marshal()`? what does this method? – Fabrizio Fenoglio Jul 09 '14 at 12:13
  • 2
    The `marshal` method will take care of firing the correct job handler class. To fire jobs onto the push queue, just use the same `Queue::push` method used for conventional queues or `Queue::pushRaw` to push messages to specific queue. – Dmitriy Jul 09 '14 at 15:41