class Vx::Common::AMQP::Config

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]
spawn_attempts[RW]

Public Class Methods

new() click to toggle source
# File lib/vx/common/amqp/config.rb, line 13
def initialize
  reset!
end

Public Instance Methods

debug?() click to toggle source
# File lib/vx/common/amqp/config.rb, line 25
def debug?
  @debug || ENV['VX_COMMON_AMQP_DEBUG']
end
default_exchange_name() click to toggle source
# File lib/vx/common/amqp/config.rb, line 21
def default_exchange_name
  "amq.#{default_exchange_type}"
end
formatter() click to toggle source
# File lib/vx/common/amqp/config.rb, line 17
def formatter
  Common::AMQP::Formatter
end
reset!() click to toggle source
# File lib/vx/common/amqp/config.rb, line 33
def reset!
  @default_exchange_type = :topic
  @pool_timeout          = 0.1
  @heartbeat             = 10

  @publishing_builder    = nil
  @recieving_builder     = nil
  @subscribing_builder   = nil

  @spawn_attempts        = 1

  @content_type          = 'application/json'

  @callbacks             = {}
  @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,
    autodelete:  false,
    exclusive:   false
  }

  @default_publish_options = {
    durable:     false
  }

end
use(target, middleware, *args) click to toggle source
# File lib/vx/common/amqp/config.rb, line 29
def use(target, middleware, *args)
  @builders[target].use middleware, *args
end