lib/propono/components/sqs_message.rb in propono-1.7.0 vs lib/propono/components/sqs_message.rb in propono-2.0.0.rc1
- old
+ new
@@ -1,19 +1,16 @@
module Propono
class SqsMessage
- include Sqs
-
- attr_reader :context, :message, :raw_message, :receipt_handle, :failure_count
+ attr_reader :context, :message, :receipt_handle, :failure_count
def initialize(raw_message)
- raw_body = raw_message["Body"]
+ raw_body = raw_message.body
@raw_body_json = JSON.parse(raw_body)
body = JSON.parse(@raw_body_json["Message"])
- @raw_message = raw_message
@context = Propono::Utils.symbolize_keys body
@failure_count = context[:num_failures] || 0
@message = context.delete(:message)
- @receipt_handle = raw_message["receipt_handle"]
+ @receipt_handle = raw_message.receipt_handle
end
def to_json_with_exception(exception)
message = @raw_body_json.dup
context = {}