Sha256: ad7b0ed0a443454fc554119c44c985eab1e75b37b797b28d003483f03fc04e98

Contents?: true

Size: 921 Bytes

Versions: 15

Compression:

Stored size: 921 Bytes

Contents

require 'vx/common/amqp'
require 'vx/common/error_notifier'

module Vx
  module Common

    module AMQP
      extend self

      def setup(logger, options = {})
        Vx::Common::AMQP.configure do |c|

          c.before_subscribe do |e|
            logger.warn "[#{e[:name]}] subsribing #{e[:exchange].name}"
          end

          c.after_subscribe do |e|
            logger.warn "[#{e[:name]}] shutdown"
          end

          c.before_recieve do |e|
            logger.warn "[#{e[:name]}] payload recieved #{e[:payload].inspect[0..60]}"
          end

          c.after_recieve do |e|
            logger.warn "[#{e[:name]}] commit message"
          end

          c.on_error do |e|
            Vx::Common::ErrorNotifier.notify(e)
          end

          c.content_type = 'application/x-protobuf'
          c.logger       = nil
          c.url          = options[:url]

        end
      end
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
vx-common-0.3.2 lib/vx/common/amqp_setup.rb
vx-common-0.3.1 lib/vx/common/amqp_setup.rb
vx-common-0.3.0 lib/vx/common/amqp_setup.rb
vx-common-0.2.1 lib/vx/common/amqp_setup.rb
vx-common-0.2.0.pre38 lib/vx/common/amqp_setup.rb
vx-common-0.2.0.pre37 lib/vx/common/amqp_setup.rb
vx-common-0.2.0.pre36 lib/vx/common/amqp_setup.rb
vx-common-0.2.0.pre35 lib/vx/common/amqp_setup.rb
vx-common-0.2.0.pre34 lib/vx/common/amqp_setup.rb
vx-common-0.2.0.pre33 lib/vx/common/amqp_setup.rb
vx-common-0.2.0.pre32 lib/vx/common/amqp_setup.rb
vx-common-0.2.0.pre31 lib/vx/common/amqp_setup.rb
vx-common-0.2.0.pre30 lib/vx/common/amqp_setup.rb
vx-common-0.2.0.pre29 lib/vx/common/amqp_setup.rb
vx-common-0.2.0.pre28 lib/vx/common/amqp_setup.rb