lib/phobos/actions/process_message.rb in phobos-1.9.0 vs lib/phobos/actions/process_message.rb in phobos-2.0.0.pre.beta1

- old
+ new

@@ -33,50 +33,15 @@ end end private - def preprocess(payload, handler) - if handler.respond_to?(:before_consume) - Phobos.deprecate('before_consume is deprecated and will be removed in 2.0. \ - Use around_consume and yield payload and metadata objects.') - begin - handler.before_consume(payload, @metadata) - rescue ArgumentError - handler.before_consume(payload) - end - else - payload - end - end - - def consume_block(payload, handler) - proc { |around_payload, around_metadata| - if around_metadata - handler.consume(around_payload, around_metadata) - else - Phobos.deprecate('Calling around_consume without yielding payload and metadata \ - is deprecated and will be removed in 2.0.') - handler.consume(payload, @metadata) - end - } - end - def process_message(payload) instrument('listener.process_message', @metadata) do handler = @listener.handler_class.new - preprocessed_payload = preprocess(payload, handler) - block = consume_block(preprocessed_payload, handler) - - if @listener.handler_class.respond_to?(:around_consume) - # around_consume class method implementation - Phobos.deprecate('around_consume has been moved to instance method, please update '\ - 'your consumer. This will not be backwards compatible in the future.') - @listener.handler_class.around_consume(preprocessed_payload, @metadata, &block) - else - # around_consume instance method implementation - handler.around_consume(preprocessed_payload, @metadata, &block) + handler.around_consume(payload, @metadata) do |around_payload, around_metadata| + handler.consume(around_payload, around_metadata) end end end end end