{"id":25874666,"url":"https://github.com/lyft/fake_sqs","last_synced_at":"2025-03-02T09:28:41.700Z","repository":{"id":18999796,"uuid":"22221989","full_name":"lyft/fake_sqs","owner":"lyft","description":"An implementation of a local SQS service.","archived":false,"fork":false,"pushed_at":"2020-08-21T00:47:37.000Z","size":58,"stargazers_count":14,"open_issues_count":2,"forks_count":9,"subscribers_count":7,"default_branch":"master","last_synced_at":"2023-04-10T04:51:25.650Z","etag":null,"topics":["lyft"],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lyft.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"MIT-LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-07-24T17:04:53.000Z","updated_at":"2023-01-28T23:47:49.000Z","dependencies_parsed_at":"2022-09-10T15:50:43.663Z","dependency_job_id":null,"html_url":"https://github.com/lyft/fake_sqs","commit_stats":null,"previous_names":[],"tags_count":0,"template":null,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lyft%2Ffake_sqs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lyft%2Ffake_sqs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lyft%2Ffake_sqs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lyft%2Ffake_sqs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lyft","download_url":"https://codeload.github.com/lyft/fake_sqs/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241485264,"owners_count":19970453,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["lyft"],"created_at":"2025-03-02T09:28:41.258Z","updated_at":"2025-03-02T09:28:41.678Z","avatar_url":"https://github.com/lyft.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Fake SQS [![Build Status](https://secure.travis-ci.org/iain/fake_sqs.png)](http://travis-ci.org/iain/fake_sqs)\n\nInspired by [Fake DynamoDB] [fake_dynamo], this is an AWS SQS compatible\nmessage queue that can be ran locally. This makes it ideal for integration\ntesting, just like you would have a local database running. Fake SQS doesn't\npersist anything, not even the queues themselves. You'll have to create the\nqueues everytime you start it.\n\nThis implementation is **not complete** yet, but should be useful already.\n\nDone so far are:\n\n* Creating queues\n* Deleting queues\n* Listing queues (with prefixes)\n* Get queue url via the name\n* Send messages (and in batch)\n* Receive messages (and in batch)\n* Deleting messages (and in batch)\n* Changing queue attributes (but not all, and no validation)\n* Setting visibility timeouts for messages\n\nCertain bits are left off on purpose, to make it easier to work with, such as:\n\n* No checking on access keys or signatures\n* No 60 second delay between deleting a queue and recreating it.\n\nOther parts are just not done yet:\n\n* Permissions\n* Error handling\n\nSo, actually, just the basics are implemented at this point.\n\nPS. There is also [Fake SNS] [fake_sns].\n\n## Usage\n\nTo install:\n\n```\n$ gem install fake_sqs\n```\n\nTo start:\n\n```\n$ fake_sqs\n```\n\nTo configure, see the options in the help:\n\n```\n$ fake_sqs --help\n```\n\nBy default, FakeSQS uses an in-memory database (just a hash actually). To make\nit persistant, run with:\n\n```\n$ fake_sqs --database /path/to/database.yml\n```\n\nMessages are not persisted, just the queues.\n\nThis is an example of how to configure the official [aws-sdk gem] [aws-sdk], to\nlet it talk to Fake SQS.\n\n``` ruby\nAWS.config(\n  :use_ssl           =\u003e false,\n  :sqs_endpoint      =\u003e \"localhost\",\n  :sqs_port          =\u003e 4568,\n  :access_key_id     =\u003e \"access key id\",\n  :secret_access_key =\u003e \"secret access key\"\n)\n```\n\nIf you have the configuration options for other libraries, please give them to\nme.\n\nTo reset the entire server, during tests for example, send a DELETE request to\nthe server. For example:\n\n```\n$ curl -X DELETE http://localhost:4568/\n```\n\nWithin SQS, after receiving, messages will be available again automatically\nafter a certain time. While this is not implemented (for now at least), you can\ntrigger this behavior at at will, with a PUT request.\n\n```\n$ curl -X PUT http://localhost:4568/\n```\n\n\n### Test Integration\n\nWhen making integration tests for your app, you can easily include Fake SQS.\n\nHere are the methods you need to run FakeSQS programmatically.\n\n``` ruby\nrequire \"fake_sqs/test_integration\"\n\n# globally, before the test suite starts:\nAWS.config(\n  use_ssl:            false,\n  sqs_endpoint:       \"localhost\",\n  sqs_port:           4568,\n  access_key_id:      \"fake access key\",\n  secret_access_key:  \"fake secret key\",\n)\nfake_sqs = FakeSQS::TestIntegration.new\n\n# before each test that requires SQS:\nfake_sqs.start\n\n# at the end of the suite:\nat_exit {\n  fake_sqs.stop\n}\n```\n\nBy starting it like this it will start when needed, and reset between each test.\n\nHere's an example for RSpec to put in `spec/spec_helper.rb`:\n\n``` ruby\nAWS.config(\n  use_ssl:            false,\n  sqs_endpoint:       \"localhost\",\n  sqs_port:           4568,\n  access_key_id:      \"fake access key\",\n  secret_access_key:  \"fake secret key\",\n)\n\nRSpec.configure do |config|\n  config.treat_symbols_as_metadata_keys_with_true_values = true\n  config.before(:suite) { $fake_sqs = FakeSQS::TestIntegration.new }\n  config.before(:each, :sqs) { $fake_sqs.start }\n  config.after(:suite) { $fake_sqs.stop }\nend\n```\n\nNow you can use the `:sqs metadata to enable SQS integration:\n\n``` ruby\ndescribe \"something with sqs\", :sqs do\n  it \"should work\" do\n    queue = AWS::SQS.new.queues.create(\"my-queue\")\n  end\nend\n```\n\n## Development\n\nRun all the specs:\n\n```\n$ rake\n```\n\nThis will run the unit tests, then the acceptance tests for both types of\nstorage (in-memory and on disk).\n\nWhen debugging an acceptance test, you can run it like this, which will redirect\noutput to the console:\n\n```\n$ DEBUG=true SQS_DATABASE=tmp/sqs.yml rspec spec/acceptance\n```\n\n\n  [fake_dynamo]: https://github.com/ananthakumaran/fake_dynamo\n  [aws-sdk]: https://github.com/amazonwebservices/aws-sdk-for-ruby\n  [fake_sns]: https://github.com/yourkarma/fake_sns\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flyft%2Ffake_sqs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flyft%2Ffake_sqs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flyft%2Ffake_sqs/lists"}