Processing items in an SQS queue using a PHP script

Here is my situation:

I have a script that receives raw data, stores it in the database, gets the identifier of the element, and then sends it to the SQS azatone queue.

I have another script (written in PHP) that extracts raw data from db and processes it. (usually takes a few minutes.

The invalid part is retrieving messages from SQS for processing. The frequency of new processing data varies; it can go from a few items per hour to dozens of items per minute.

One way would be to have a cron job that requests SQS for new messages and starts the script processing (it must be multithreaded and written by something other than php. Maybe Python or Ruby). The problem with cron is that it is rather inefficient, in phases of high load it will be overloaded and in quiet phases it will make useless calls.

What I would like to have is some kind of multi-threaded listener that will receive messages and process them. One of the important requirements is that the raw data be processed in a timely manner, a couple of minutes after receiving no more.

Any thoughts on a better solution? Does SQS fit the task? What is the most efficient way to listen and process a queue?

+1
multithreading php amazon-web-services amazon-sqs message-queue
source share

No one has answered this question yet.

See similar questions:

8
Handling SQS Queues with boto

or similar:

4270
Link. What does this symbol mean in PHP?
2776
How can I prevent SQL injection in PHP?
2414
Why shouldn't I use mysql_ * functions in PHP?
2335
Removing an element from an array in PHP
2024
How do you parse and process HTML / XML in PHP?
1906
How does PHP foreach work?
1624
How do I get PHP errors?
1487
What is the difference between process and thread?
1387
startsWith () and endsWith () functions in PHP
8
Handling SQS Queues with boto

All Articles