lib/rising_dragon/sqs/worker.rb in rising_dragon-0.3.4 vs lib/rising_dragon/sqs/worker.rb in rising_dragon-0.4.0

- old
+ new

@@ -8,21 +8,21 @@ base.extend(ClassMethods) end module ClassMethods def rising_dragon_options(sqs_queue_name, opt = {}) - shoryuken_opt = { queue: sqs_queue_name, body_parser: :json, auto_delete: true, shoryuken_group: "default" }.merge(opt) + shoryuken_opt = { queue: sqs_queue_name, body_parser: :json, auto_delete: true, shoryuken_group: 'default' }.merge(opt) shoryuken_options(shoryuken_opt) - register_queue(sqs_queue_name, shoryuken_opt["shoryuken_group"], opt) # shoryuken_options will change hash key.... :( + register_queue(sqs_queue_name, shoryuken_opt['shoryuken_group'], opt) # shoryuken_options will change hash key.... :( end def register_queue(sqs_queue_name, group_name, option) - concurrency = option["concurrency"] || 25 + concurrency = option['concurrency'] || 25 Shoryuken.add_group(group_name, concurrency) - weight = option["weight"] || 1 + weight = option['weight'] || 1 Shoryuken.add_queue(sqs_queue_name, weight, group_name) end def rising_dragon_register(event_name, handle_class) emitter.register(event_name, handle_class) @@ -35,12 +35,12 @@ def emitter @emitter ||= ::RisingDragon::SQS::Emitter.new end end - def perform(_sqs_msg, body) - self.class.emitter.emit_sns_msg(body) - rescue => e + def perform(sqs_msg, body) + self.class.emitter.emit_sqs_msg(sqs_msg, body) + rescue StandardError => e rescue_from(e) end def rescue_from(e) # overwrite here