2

I have a problem concerning the fact that my queues are received by IronMQ but not fire off. Like i ask in this question: https://stackoverflow.com/questions/19200285/laravel4-ironmq-queue-are-not-executed

But i see that inside my Iron dashboard, after i subscribe a new domain, then it is not added in any list. Probably IronMQ should display a list of Domains subscribed, isn't it? And this is probably the reason why my queues are not fire off. How can i fix the issue? Thanks!

Community
  • 1
  • 1
FrancescoMussi
  • 20,760
  • 39
  • 126
  • 178

2 Answers2

9

I'm not sure you have done all steps you need to do to have your queues subscribed, so let's take a look at them:

Configure your queue to be default as Iron in the file app/config/queue.php, set:

'default' => 'iron',

And configure your connection:

'iron' => array(
    'driver'  => 'iron',
    'project' => 'YOUR PROJECT NUMBER',
    'token'   => 'YOUR TOKEN',
    'queue'   => 'YOUR QEUE NAME',
),

Create a route for your queue/receive end-point and return the response from the Queue::marshal method:

Route::post('queue', function()
{

    Log::info('marshal!');

    return Queue::marshal();

});

And test it! Outside your server acess it using a curl or something like that:

curl --data "param1=whatever" http://<your.domain.com>/queue

edit: You can copy this whole line and just replate with your url.

Open your log file in the folder:

app/storage/logs/

You should see something like this there:

[2013-10-10 10:26:09] log.INFO: marshal! [] []

It was generated by Log::info('marshal!'); we added to your marshal router. But you may also see an error saying 'Invalid data.', igore it, we were not doing a real test, we just needed to know if your marshal route was working.

Now you can register your url for a particular queue on IronMQ:

php artisan queue:subscribe <queue name on IronMQ> <url>

An example would be:

php artisan queue:subscribe johnnyfittizio http://<your.domain.com>/queue

This is the same url you used in the test before.

This command MUST show you:

Queue subscriber added: http://<your.domain.com>/queue

If it doesn't, you have to check your configuration again, you might have done something wrong there.

Then you can go to your IronMQ's queue page and check if your queue is subscribed:

1. Go to https://hud.iron.io/dashboard

2. On your projects, click in tue MQ button of your project

3. Select the "Queues" tab

4. Click on your queue name, this must be the same you subscribed to using the command "artisan queue:subscribe"

5.In the "PUSH INFORMATION" box, check if your queue push type is set to "multicast".

6.Check if your queue is subscribed in the "SUBSCRIBERS" box, it's in the page bottom right area.

If everything is set, fire your e-mail (via queue) again and check the log to see if "log.INFO: marshal!" shows up there. This time it must show but being called by IronMQ.

If it does and you don`t get an e-mail, the queue is working and you have to check your e-mail configuration.

Antonio Carlos Ribeiro
  • 86,191
  • 22
  • 213
  • 204
  • Thank you for your reply. But i am still stuck in the same situation: i receive the queue in IronMQ but is not fired. Doing what you said i get this 3 errors: On the log file there was this error: [2013-10-10 14:16:44] log.ERROR: exception 'Symfony\Component\HttpKernel\Exception\MethodNotAllowedHttpException'. Adding the queue from PowerShell i got this error: Iron.io based queue must be default. Anyway i added, as you said, manually from IronMQ dashboard. And again after adding it manually, nothing is displayed in any list. In any case if i open MYAPP/queue the queue is received in IronMQ – FrancescoMussi Oct 10 '13 at 14:26
  • Every time you manually subscribe a URL inside IronMQ it is then displayed in a list right? – FrancescoMussi Oct 10 '13 at 15:03
  • I just edited the TOP of the answer to include the configuration details. The error "Iron.io based queue must be default." must be that. MethodNotAllowedHttpException is because you're trying to access your POST method using a GET request. Did you used CURL --data to access it? – Antonio Carlos Ribeiro Oct 10 '13 at 15:08
  • The queue.php was already properly configured. To access the site i used curl http://MYAPP.COM/queue. I did not knew what parameters pass as data. – FrancescoMussi Oct 10 '13 at 15:15
  • That line I wrote for curl was the one I used here to test. Just replace the url with yours and it will work. You don`t need to pass a real data, it's not a real test, but it MUST be a POST method. As I told you in the answer: `But you may also see an error saying 'Invalid data.', igore it, we were not doing a real test, we just needed to know if your marshal route was working.` – Antonio Carlos Ribeiro Oct 10 '13 at 15:27
  • Ok, i did as you say and this time i see: [2013-10-10 15:46:56] log.INFO: marshal! [] [] [2013-10-10 15:46:56] log.ERROR: exception 'Illuminate\Encryption\DecryptException' with message 'Invalid data.' But then i try to add manually the URL and it does not show up in an y list, inside IronMQ. – FrancescoMussi Oct 10 '13 at 15:50
  • Do you get any errors? Does it say `Queue subscriber added: http://whatever` ? If it is saying that it is not only adding a subscriber url, it is also adding a new queue, if yours doesn`t exists yet. So get back to your project and take a look at your queues again. – Antonio Carlos Ribeiro Oct 10 '13 at 15:54
  • let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/38989/discussion-between-antonio-carlos-ribeiro-and-johnnyfittizio) – Antonio Carlos Ribeiro Oct 10 '13 at 15:55
  • Guys, I did everything described here except the route/subscribe part (because I'm developing on localhost). I think everything else is properly configured. I can use Mail::queue() and it doesn't return any error (it simply doesn't send the mail). So, for it to send mail I just have to host the server online and do those last 2 steps (route + subscribe), right? – Pedro Moreira Jul 11 '14 at 20:39
2

Thanks to Antonio Ribeiro for his help! There was a little change to make to make everything working: Into IronMQ i had to change the type of queue, from PULL to MULTICAST Now i can see at last my list of subscribed URLs. And if i run the test app, it works smoothly and the queues are fired off properly.

If you want to know why, this was the answer from Iron.io support:

as I see in attached image your queue has "pull" type. It means queue does not fire HTTP(S) POST to endpoint and you need to get messages through API (or "get" method/function in client library). To turn your queue to "push" type you can: 1) update queue info and add at least one push queue related parameters (for example, "subscribers": [ {"url": "proto://domain/path"} ] ). See more information on http://dev.iron.io/mq/reference/push_queues/ 2) through the HUD, changing type of queue.

EDIT:

Ok, just for the last clarification: also UNICAST is possible to set. The difference between the two was explained by Iron.io support:

Yes, you are able to add URLs to your push queues, both multicast and unicast.
Multicast sends message through POST to all subscribers URLs at the same time 
and retries on failed endpoints. 
But unicast sends to subscribers by turn while one of them returns 
right response and retries if all endpoints in subscribers list failed.
FrancescoMussi
  • 20,760
  • 39
  • 126
  • 178