Class: StompJob::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/stomp_job/configuration.rb

Constant Summary collapse

DEFAULT_CLIENT_CONFIG =
{
  hosts: [
    {login: "", passcode: "", host: "localhost", port: 61613}
  ],
  reliable: true,
  initial_reconnect_delay: 0.01,
  max_reconnect_delay: 30.0,
  use_exponential_back_off: true,
  back_off_multiplier: 2,
  max_reconnect_attempts: 0,
  randomize: false,
  connect_timeout: 0,
  connect_headers: {
    "accept-version" => "1.1",
    "host" => "localhost",
    "heart-beat" => "60000,60000"
  },
  parse_timeout: 5,
  logger: nil,
  dmh: false,
  closed_check: true,
  hbser: true,
  stompconn: false,
  usecrlf: false,
  max_hbread_fails: 0,
  max_hbrlck_fails: 0,
  fast_hbs_adjust: 20.0,
  tcp_nodelay: true,
  start_timeout: 0,
  sslctx_newparm: nil,
  ssl_post_conn_check: true
}

Class Method Summary collapse

Class Method Details

.configurationObject



37
38
39
# File 'lib/stomp_job/configuration.rb', line 37

def self.configuration
  @configuration ||= DEFAULT_CLIENT_CONFIG
end

.load_config!(file = "config/stomp_job.yml") ⇒ Object



49
50
51
52
53
# File 'lib/stomp_job/configuration.rb', line 49

def self.load_config!(file="config/stomp_job.yml")
  raise 'YAML undefined! You must require YAML to use the StompJob::Configuration.load_config! method!' unless defined?(YAML)
  reset_configuration!
  configuration.merge! deep_symbolize_keys(YAML.load_file(file))
end

.reset_configuration!Object



41
42
43
# File 'lib/stomp_job/configuration.rb', line 41

def self.reset_configuration!
  @configuration = DEFAULT_CLIENT_CONFIG
end

.setup {|configuration| ... } ⇒ Object

Yields:



45
46
47
# File 'lib/stomp_job/configuration.rb', line 45

def self.setup
  yield configuration
end