Class: Nagare::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/nagare/config.rb

Overview

Configuration class for Nagare. See the README for possible values and what they do

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.dlq_streamObject

Returns the value of attribute dlq_stream.



8
9
10
# File 'lib/nagare/config.rb', line 8

def dlq_stream
  @dlq_stream
end

.error_handlerObject

Returns the value of attribute error_handler.



8
9
10
# File 'lib/nagare/config.rb', line 8

def error_handler
  @error_handler
end

.group_nameObject

Returns the value of attribute group_name.



8
9
10
# File 'lib/nagare/config.rb', line 8

def group_name
  @group_name
end

.max_retriesObject

Returns the value of attribute max_retries.



8
9
10
# File 'lib/nagare/config.rb', line 8

def max_retries
  @max_retries
end

.min_idle_timeObject

Returns the value of attribute min_idle_time.



8
9
10
# File 'lib/nagare/config.rb', line 8

def min_idle_time
  @min_idle_time
end

.redis_urlObject

Returns the value of attribute redis_url.



8
9
10
# File 'lib/nagare/config.rb', line 8

def redis_url
  @redis_url
end

.suffixObject

Returns the value of attribute suffix.



8
9
10
# File 'lib/nagare/config.rb', line 8

def suffix
  @suffix
end

.threadsObject

Returns the value of attribute threads.



8
9
10
# File 'lib/nagare/config.rb', line 8

def threads
  @threads
end

Class Method Details

.configure {|_self| ... } ⇒ Object

Runs code in the block passed in to configure Nagare and sets defaults when values are not set.

returns [Nagare::Config] self rubocop:disable Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity, Metrics/MethodLength, Metrics/AbcSize

Yields:

  • (_self)

Yield Parameters:



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/nagare/config.rb', line 16

def configure
  yield(self)
  @dead_consumer_timeout ||= 5000
  @group_name ||= 'nagare'
  @redis_url = redis_url || ENV['REDIS_URL'] || 'redis://localhost:6379'
  @threads ||= 1
  @suffix ||= nil
  @min_idle_time ||= 600_000
  @error_handler ||= proc do |message, error|
    Nagare.logger.error "Failed to process message #{message}"
    Nagare.logger.error error.message
    Nagare.logger.error error.backtrace.join("\n")
  end
  @dlq_stream ||= 'dlq'
  @max_retries ||= 10
  self
end