22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
# File 'app/services/nuntius/aws_sns_processor_service.rb', line 22
def perform
if context.notification["Type"] == "SubscriptionConfirmation"
Nuntius.config.logger.info("Confirming SNS subscription")
Faraday.get(body["SubscribeURL"])
return
end
type = context.notification["notificationType"]
unless message_id
Nuntius.config.logger.warn("SNS / SES message could not determine message id: #{context.notification}")
return false
end
unless message
Nuntius.config.logger.warn("SNS / SES message for unknown message with message id: #{message_id}")
return false
end
Nuntius.config.logger.info("SNS /SES updating message #{message.id} for #{type}")
case type
when "Delivery"
process_delivery
when "Bounce"
process_bounce
when "Complaint"
process_complaint
else
false
end
end
|