rubyonjets / jets

Ruby on Jets
http://rubyonjets.com
MIT License
2.6k stars 181 forks source link

How do we develop against sqs locally? #306

Closed relwell closed 5 years ago

relwell commented 5 years ago

I'm not finding any documentation on developing jobs against SQS locally.

Ideally, I'd like to publish to a local sqs (e.g. localstack or sqs-local), and have Jets consume from that queue and run it so that I can test locally before deploying.

My guess here is that we're relying on SQS triggers in production, but we can't do that in development mode.

I'm currently exploring using Shoryuken to support my present use case, but I think it makes sense to have an integrated approach here.

Thoughts? Thanks!

tongueroo commented 5 years ago

Trying to keep questions on the https://community.rubyonjets.com/ forums to keep issues cleaner. So let's post questions in here. 👍

Here's a quick answer:

SQS events trigger jobs. So one way to test is to use the .perform_now method and pass in the event you're testing. Example:

event = JSON.load(IO.read("spec/fixtures/sqs/event.json"))
PostmanJob.perform_now(:delivery, event)