lib/pheme/queue_poller.rb in pheme-1.2.1 vs lib/pheme/queue_poller.rb in pheme-1.2.2
- old
+ new
@@ -6,10 +6,11 @@
attr_accessor :queue_url, :queue_poller, :connection_pool_block, :format, :max_messages, :poller_configuration
def initialize(queue_url:, connection_pool_block: false, max_messages: nil, format: :json, poller_configuration: {}, sqs_client: nil)
raise ArgumentError, "must specify non-nil queue_url" unless queue_url.present?
+
@queue_url = queue_url
@queue_poller = Aws::SQS::QueuePoller.new(queue_url, client: sqs_client)
@connection_pool_block = connection_pool_block
@messages_processed = 0
@messages_received = 0
@@ -68,10 +69,11 @@
parsed_content = parse_json(raw_content)
body['Message'] = parsed_content
else
method_name = "parse_#{format}".to_sym
raise ArgumentError, "Unknown format #{format}" unless respond_to?(method_name)
+
parsed_content = __send__(method_name, raw_content)
body['Records'] = parsed_content
end
log_message_received(queue_message, body)
@@ -144,19 +146,19 @@
end_time: time_end.utc.iso8601,
}.to_json)
end
def log_delete(queue_message)
- Pheme.logger.info({
+ Pheme.logger.debug({
message: "#{self.class} deleted message #{queue_message.message_id}",
message_id: queue_message.message_id,
queue_poller: self.class.to_s,
queue_url: queue_url,
}.to_json)
end
def log_message_received(queue_message, body)
- Pheme.logger.info({
+ Pheme.logger.debug({
message: "#{self.class} received message #{queue_message.message_id}",
queue_poller: self.class.to_s,
message_id: queue_message.message_id,
queue_url: queue_url,
body: body,