softwaremill / elasticmq

In-memory message queue with an Amazon SQS-compatible interface. Runs stand-alone or embedded.
https://softwaremill.com/open-source/
Apache License 2.0
2.51k stars 194 forks source link

SQS short polling not possible in strict mode? #70

Closed Nakiami closed 8 years ago

Nakiami commented 8 years ago

Hi,

it does not seem possible to send a WaitTimeSeconds of 0 when receiving a message from a queue.

In the SQS documentation it states that

Short polling occurs when the WaitTimeSeconds parameter of a ReceiveMessage call is set to 0. This happens in one of two ways – either the ReceiveMessage call sets WaitTimeSeconds to 0, or the ReceiveMessage call doesn’t set WaitTimeSeconds and the queue attribute ReceiveMessageWaitTimeSeconds is 0.

But in ElasticMQ, when in strict mode, we seem to be enforcing values between and including 1 and 20. Example: https://github.com/adamw/elasticmq/blob/161eae5f6b828bfb4445d41e25d5cc34430a6614/rest/rest-sqs/src/main/scala/org/elasticmq/rest/sqs/SQSRestServerBuilder.scala#L370

Is this intended behavior?

Some libraries, like spring-cloud-aws defaults to 0 WaitTimeSeconds on receive, and cannot be easily changed for some methods. The workaround for using spring-cloud-sqs seems to be to disable strict mode in ElasticMQ.

adamw commented 8 years ago

Can you try version 0.9.2-SNAPSHOT, https://s3-eu-west-1.amazonaws.com/softwaremill-public/elasticmq-server-0.9.2-SNAPSHOT.jar ?

adamw commented 8 years ago

Thanks for reporting, if the SQS spec says otherwise it's definitely not intended behavior :)

Nakiami commented 8 years ago

0.9.2-SNAPSHOT works as expected, thanks!

adamw commented 8 years ago

Great, 0.9.2 released :)