开发者

If I have a queue (SQS, AMQP), how do I notify my worker servers when there is an object in it?

A lot of times my queue will remain empty. But when it开发者_高级运维 does fill up, how does that queue notify my server to execute a python script?

I could make it so that the python script hits the queue every 5 seconds, but that's silly.


You should have a consumer on the queue, which registers a callback. The consumer will then poll the queue and call the callback when an item is received.

You don't say how you're accessing the queue, but a library like carrot does this for you.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜