質問

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!

役に立ちましたか?

解決

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.

他のヒント

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.
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top