class Vx::Consumer::Configuration

Attributes

builders[RW]
content_type[RW]
debug[RW]
default_exchange_options[RW]
default_exchange_type[RW]
default_publish_options[RW]
default_queue_options[RW]
heartbeat[RW]
instrumenter[RW]
on_error[RW]
pool_timeout[RW]
prefetch[RW]
spawn_attempts[RW]

Public Class Methods

new() click to toggle source
# File lib/vx/consumer/configuration.rb, line 12
def initialize
  reset!
end

Public Instance Methods

debug?() click to toggle source
# File lib/vx/consumer/configuration.rb, line 16
def debug?
  ENV['VX_CONSUMER_DEBUG']
end
reset!() click to toggle source
# File lib/vx/consumer/configuration.rb, line 29
def reset!
  @default_exchange_type = :topic
  @pool_timeout          = 0.5
  @heartbeat             = :server

  @spawn_attempts        = 1

  @content_type          = 'application/json'
  @prefetch              = 1

  @instrumenter          = nil
  @on_error              = ->(e, env){ nil }

  @builders = {
    pub: Vx::Common::Rack::Builder.new,
    sub: Vx::Common::Rack::Builder.new
  }

  @default_exchange_options = {
    durable:     true,
    auto_delete: false
  }

  @default_queue_options = {
    durable:      true,
    auto_delete:  false,
    exclusive:    false
  }

  @default_publish_options = {
  }
end
use(target, middleware, *args) click to toggle source
# File lib/vx/consumer/configuration.rb, line 20
def use(target, middleware, *args)
  @builders[target].use middleware, *args
end