Sha256: 00b39619f32b74a8ce3d20cf351b4166b7af9816b92ea95c1d8187306394efa3
Contents?: true
Size: 1.07 KB
Versions: 3
Compression:
Stored size: 1.07 KB
Contents
require 'alephant/logger' module Alephant module Broker module Response class Batch < Base include Logger attr_reader :components, :batch_id def initialize(components, batch_id) @components = components @batch_id = batch_id super(200, 'application/json') end def setup @content = ::JSON.generate({ 'batch_id' => batch_id, 'components' => json }) end private def json logger.info "Broker: Batch load started (#{batch_id})" components.map do |component| { 'component' => component.id, 'options' => component.options, 'status' => component.status, 'content_type' => component.content_type, 'body' => component.content } end.tap { logger.info "Broker: Batch load done (#{batch_id})" logger.metric "BrokerBatchLoadCount" } end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
alephant-broker-3.8.0 | lib/alephant/broker/response/batch.rb |
alephant-broker-3.7.1 | lib/alephant/broker/response/batch.rb |
alephant-broker-3.7.0 | lib/alephant/broker/response/batch.rb |