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.53k stars 193 forks source link

Support for wait_time_seconds=? #5

Closed ahannon-fiksu closed 11 years ago

ahannon-fiksu commented 11 years ago

Hello,

I am attempting to use elasticmq for as a fake backend for local testing. With the exception of one call, it seems to work very well (for my purposes, at least). Below, I attempt to set the default wait_time_seconds attribute value, which leads to an exception. The read operation surprisingly works. Is this something that is intended to be supported?

aws_options = {
  use_ssl: false,
  sqs_endpoint: "localhost",
  sqs_port: 9324,
  access_key_id: "xxx",
  secret_access_key: "xxx"
}
AWS.config(aws_options)

sqs = AWS::SQS.new
queue_name = "test_queue"
q = sqs.queues.create(queue_name)
# Returns 0:
q.wait_time_seconds
# Raises an exception with elasticmq, but not SQS:
q.wait_time_seconds = 20

The backtrace is:

AWS::SQS::Errors::InvalidAttributeName: See the SQS docs.
    from /Users/ahannon/.rvm/gems/ruby-1.9.3-p327@event_queue_manager/gems/aws-sdk-1.10.0/lib/aws/core/client.rb:360:in `return_or_raise'
    from /Users/ahannon/.rvm/gems/ruby-1.9.3-p327@event_queue_manager/gems/aws-sdk-1.10.0/lib/aws/core/client.rb:461:in `client_request'
    from (eval):3:in `set_queue_attributes'
    from /Users/ahannon/.rvm/gems/ruby-1.9.3-p327@event_queue_manager/gems/aws-sdk-1.10.0/lib/aws/sqs/queue.rb:754:in `set_attribute'
    from /Users/ahannon/.rvm/gems/ruby-1.9.3-p327@event_queue_manager/gems/aws-sdk-1.10.0/lib/aws/sqs/queue.rb:405:in `wait_time_seconds='
    from (irb):18
    from /Users/ahannon/.rvm/gems/ruby-1.9.3-p327@event_queue_manager/gems/bundler-1.3.5/lib/bundler/cli.rb:619:in `console'
    from /Users/ahannon/.rvm/gems/ruby-1.9.3-p327@event_queue_manager/gems/bundler-1.3.5/lib/bundler/vendor/thor/task.rb:27:in `run'
    from /Users/ahannon/.rvm/gems/ruby-1.9.3-p327@event_queue_manager/gems/bundler-1.3.5/lib/bundler/vendor/thor/invocation.rb:120:in `invoke_task'
    from /Users/ahannon/.rvm/gems/ruby-1.9.3-p327@event_queue_manager/gems/bundler-1.3.5/lib/bundler/vendor/thor.rb:344:in `dispatch'
    from /Users/ahannon/.rvm/gems/ruby-1.9.3-p327@event_queue_manager/gems/bundler-1.3.5/lib/bundler/vendor/thor/base.rb:434:in `start'
    from /Users/ahannon/.rvm/gems/ruby-1.9.3-p327@event_queue_manager/gems/bundler-1.3.5/bin/bundle:20:in `block in <top (required)>'
    from /Users/ahannon/.rvm/gems/ruby-1.9.3-p327@event_queue_manager/gems/bundler-1.3.5/lib/bundler/friendly_errors.rb:3:in `with_friendly_errors'
    from /Users/ahannon/.rvm/gems/ruby-1.9.3-p327@event_queue_manager/gems/bundler-1.3.5/bin/bundle:20:in `<top (required)>'
    from /Users/ahannon/.rvm/gems/ruby-1.9.3-p327@event_queue_manager/bin/bundle:19:in `load'
    from /Users/ahannon/.rvm/gems/ruby-1.9.3-p327@event_queue_manager/bin/bundle:19:in `<main>'

And thanks for putting the effort into this project. Cheers!

adamw commented 11 years ago

Do you know what attribute does wait_time_seconds translate to?

ahannon-fiksu commented 11 years ago

According to this, the attribute is ReceiveMessageWaitTimeSeconds.

adamw commented 11 years ago

Ah of course, long pooling. That is the missing feature in EMQ which will be added in 0.7.0 :)

adamw commented 11 years ago

Support for long pooling added in 0.7.0-SNAPSHOT.