5

As a relative newcomer to AWS, it has been a little bit of curve getting Shoryuken gem (with Active Job and Active Record) to work based on the setup documentation.

  1. Middleware: I wasn't sure if the middleware was a requisite part of setting up since it was only yielding in the basic example. Is my understanding correct that it is useful if you need to perform operations before or after fetching messages from the queue.

  2. Shoryuken inserting but not fetching messages from SQS: At this point, Shoryuken is delivering message to the SQS queue, I can see the messages (in messages visible) in the AWS console but Shoryuken is not fetching them to perform even though there is nothing in the queue.

Console

irb(main):003:0> InvitationMailer.send_invite(ii).deliver_later
    Enqueued ActionMailer::DeliveryJob (Job ID: 5c65184c-8656-42bd-95ce-e0ded78a9a44) to Shoryuken(development_mailers) with arguments: "InvitationMailer", "send_invite", "deliver_now", gid://projectname/Invitation/25
    => #<ActionMailer::DeliveryJob:0x007f7fad761a40 @arguments=["InvitationMailer", "send_invite", "deliver_now", #<Invitation id: 25, invite_code: "324234325", sender_id: 7, invitee_first_name: "Kylo", invitee_last_name: "Ren", invitee_email: "test128@somewhere.com", status: "sent", joined_member_id: nil, created_at: "2016-09-24 03:14:44", updated_at: "2016-09-24 04:16:36", invite_message: nil, sent_at: nil, accepted_at: nil, completed_at: nil, clicked_at: nil, source: nil>], @job_id="5c65184c-8656-42bd-95ce-e0ded78a9a44", @queue_name="development_mailers">

irb(main):004:0> Shoryuken.options
=> {:concurrency=>25, :queues=>[], :aws=>{}, :delay=>0, :timeout=>8, :lifecycle_events=>{:startup=>[], :quiet=>[], :shutdown=>[]}}
irb(main):005:0>

Shoryuken.yml

aws:
  access_key_id: <%= ENV['AWS_ACCESS_KEY_ID'] %>
  receive_message:
    attribute_names:
    - ApproximateReceiveCount
    - SentTimestamp
  region: <%= ENV['AWS_REGION'] %>
  secret_access_key:  <%= ENV['AWS_SECRET_ACCESS_KEY'] %>
  concurrency: 25
  delay: 0
  queues:
    - development_mailers

How can I figure out why the messages are not being retrieved and acted upon by Shoryuken?

(I had posted this issue to GitHub, but re-posted here after not receiving a response).

halfer
  • 19,824
  • 17
  • 99
  • 186
geoboy
  • 1,172
  • 1
  • 11
  • 25

1 Answers1

0

Turns out that the YAML formatting was incorrect. queues should not be under aws but at the same level. Here is the correct version:

aws:
  access_key_id: <%= ENV['AWS_ACCESS_KEY_ID'] %>
  receive_message:
    attribute_names:
    - ApproximateReceiveCount
    - SentTimestamp
  region: <%= ENV['AWS_REGION'] %>
  secret_access_key:  <%= ENV['AWS_SECRET_ACCESS_KEY'] %>
concurrency: 25
delay: 0
queues:
   - development_mailers
geoboy
  • 1,172
  • 1
  • 11
  • 25