Sha256: bb52a0f027701e8f919f379fd0eec9da548114c37939c61883b8164b3557beda
Contents?: true
Size: 1.21 KB
Versions: 1
Compression:
Stored size: 1.21 KB
Contents
require 'evrone/common/amqp' module Evrone::CI::Router::AMQP Base = Struct.new("Subscribing", :app) do include Evrone::CI::Router::Helper::Logger def consumer_name Thread.current[:consumer_name] end def consumer_id Thread.current[:consumer_id] end def consumer_tag consumer_id ? "#{consumer_name.split('::').last} #{consumer_id}" : consumer_name end end class Subscribing < Base def call(env) logger.tagged(consumer_tag) do logger.warn "subsribing #{env[:exchange].name}" rs = app.call env logger.warn "shutdown" rs end end end class Recieving < Base def call(env) logger.warn "payload recieved #{env[:payload].inspect[0...60]}..." rs = app.call env logger.warn "commit message" rs end end class Publishing < Base def call(env) app.call env end end end Evrone::Common::AMQP.configure do |c| c.subscribing do use Evrone::CI::Router::AMQP::Subscribing end c.recieving do use Evrone::CI::Router::AMQP::Recieving end c.publishing do use Evrone::CI::Router::AMQP::Publishing end c.content_type = 'application/x-protobuf' c.logger = nil end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
evrone-ci-router-0.2.0.pre0 | lib/evrone/ci/router/initializers/amqp.rb |