Class: RenoteDac::ServiceQueueWorker

Inherits:
Object
  • Object
show all
Includes:
Sneakers::Worker
Defined in:
app/workers/renote_dac/service_queue_worker.rb

Instance Method Summary collapse

Instance Method Details

#work(message) ⇒ Object

work method receives message payload in raw format in our case it is JSON encoded string which we can pass to RecentPosts service without changes



16
17
18
19
20
21
22
23
24
25
26
27
# File 'app/workers/renote_dac/service_queue_worker.rb', line 16

def work(message)
  # invoke service object to save message to database
  message = JSON.parse(message)
  RenoteDac::Mailer.enqueue(
    message['postmark_data']['template'],
    message['postmark_data']['address'],
    message['postmark_data']['params'],
    message['postmark_data']['attachments']
  )
  # let queue know message was received
  ack!
end