1

Is there a way to write a Php consumer for SQS that doesn't have to poll periodically for new messages?

The only way to consume messages I found so far is getting them using the receive_message() api call which needs to be done using periodical polling.

While it should work it still seems wrong.

2 Answers 2

5

I know this is a really old question, but just wanted to point this out for future readers.

SQS is meant for polling, but if you want a push solution, you can actually choose 'Queue Options' on the AWS SQS panel, and choose 'Subscribe to SNS Topic.'

Obviously make a SNS topic prior to doing this. You can setup the topic to automatically send a request to a URL every time an event happens, essentially turning this into a push.

Best of luck!

Sign up to request clarification or add additional context in comments.

Comments

2

The magic that lets SQS scale so well is that it offers very few features compared to other message passing systems. The user must: poll for messages; deal with messages getting delivered out of order; deal with messages getting delivered more than once; deal with occasional very large latency on message delivery (like 50 seconds).

It is great for certain tasks, and absolutely unusable for others. I for one spent far too long attempting to make it what it is not, and I really think Amazon should be more clear in their docs to warn you about not just what it is but also what is not. I ended up with RabbitMQ and couldn't be happier - but yes, there is a point at which I'll need to deal with scaling it.

1 Comment

The only reason why I want to use SQS is because I can forward SNS messages to SQS.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.