Class: Vx::Common::AMQP::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/vx/common/amqp/config.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfig

Returns a new instance of Config.



13
14
15
# File 'lib/vx/common/amqp/config.rb', line 13

def initialize
  reset!
end

Instance Attribute Details

#content_typeObject

Returns the value of attribute content_type.



9
10
11
# File 'lib/vx/common/amqp/config.rb', line 9

def content_type
  @content_type
end

#debugObject

Returns the value of attribute debug.



9
10
11
# File 'lib/vx/common/amqp/config.rb', line 9

def debug
  @debug
end

#default_exchange_optionsObject

Returns the value of attribute default_exchange_options.



9
10
11
# File 'lib/vx/common/amqp/config.rb', line 9

def default_exchange_options
  @default_exchange_options
end

#default_exchange_typeObject

Returns the value of attribute default_exchange_type.



9
10
11
# File 'lib/vx/common/amqp/config.rb', line 9

def default_exchange_type
  @default_exchange_type
end

#default_publish_optionsObject

Returns the value of attribute default_publish_options.



9
10
11
# File 'lib/vx/common/amqp/config.rb', line 9

def default_publish_options
  @default_publish_options
end

#default_queue_optionsObject

Returns the value of attribute default_queue_options.



9
10
11
# File 'lib/vx/common/amqp/config.rb', line 9

def default_queue_options
  @default_queue_options
end

#heartbeatObject

Returns the value of attribute heartbeat.



9
10
11
# File 'lib/vx/common/amqp/config.rb', line 9

def heartbeat
  @heartbeat
end

#instrumenterObject

Returns the value of attribute instrumenter.



9
10
11
# File 'lib/vx/common/amqp/config.rb', line 9

def instrumenter
  @instrumenter
end

#loggerObject

Returns the value of attribute logger.



9
10
11
# File 'lib/vx/common/amqp/config.rb', line 9

def logger
  @logger
end

#pool_timeoutObject

Returns the value of attribute pool_timeout.



9
10
11
# File 'lib/vx/common/amqp/config.rb', line 9

def pool_timeout
  @pool_timeout
end

#spawn_attemptsObject

Returns the value of attribute spawn_attempts.



9
10
11
# File 'lib/vx/common/amqp/config.rb', line 9

def spawn_attempts
  @spawn_attempts
end

#urlObject

Returns the value of attribute url.



9
10
11
# File 'lib/vx/common/amqp/config.rb', line 9

def url
  @url
end

Instance Method Details

#debug?Boolean

Returns:

  • (Boolean)


25
26
27
# File 'lib/vx/common/amqp/config.rb', line 25

def debug?
  @debug || ENV['VX_COMMON_AMQP_DEBUG']
end

#default_exchange_nameObject



21
22
23
# File 'lib/vx/common/amqp/config.rb', line 21

def default_exchange_name
  "amq.#{default_exchange_type}"
end

#formatterObject



17
18
19
# File 'lib/vx/common/amqp/config.rb', line 17

def formatter
  Common::AMQP::Formatter
end

#reset!Object



29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# File 'lib/vx/common/amqp/config.rb', line 29

def reset!
  @url                   = nil
  @logger                = ::Logger.new(STDOUT)
  @default_exchange_type = :topic
  @pool_timeout          = 0.1
  @heartbeat             = 10

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

  @spawn_attempts        = 5

  @content_type          = 'application/json'

  @callbacks             = {}
  @instrumenter          = nil

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

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

  @default_publish_options = {
    durable:     false
  }

end