Class: Nagare::Config
- Inherits:
-
Object
- Object
- Nagare::Config
- 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
-
.dlq_stream ⇒ Object
Returns the value of attribute dlq_stream.
-
.error_handler ⇒ Object
Returns the value of attribute error_handler.
-
.group_name ⇒ Object
Returns the value of attribute group_name.
-
.max_retries ⇒ Object
Returns the value of attribute max_retries.
-
.min_idle_time ⇒ Object
Returns the value of attribute min_idle_time.
-
.redis_url ⇒ Object
Returns the value of attribute redis_url.
-
.suffix ⇒ Object
Returns the value of attribute suffix.
-
.threads ⇒ Object
Returns the value of attribute threads.
Class Method Summary collapse
-
.configure {|_self| ... } ⇒ Object
Runs code in the block passed in to configure Nagare and sets defaults when values are not set.
Class Attribute Details
.dlq_stream ⇒ Object
Returns the value of attribute dlq_stream.
8 9 10 |
# File 'lib/nagare/config.rb', line 8 def dlq_stream @dlq_stream end |
.error_handler ⇒ Object
Returns the value of attribute error_handler.
8 9 10 |
# File 'lib/nagare/config.rb', line 8 def error_handler @error_handler end |
.group_name ⇒ Object
Returns the value of attribute group_name.
8 9 10 |
# File 'lib/nagare/config.rb', line 8 def group_name @group_name end |
.max_retries ⇒ Object
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_time ⇒ Object
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_url ⇒ Object
Returns the value of attribute redis_url.
8 9 10 |
# File 'lib/nagare/config.rb', line 8 def redis_url @redis_url end |
.suffix ⇒ Object
Returns the value of attribute suffix.
8 9 10 |
# File 'lib/nagare/config.rb', line 8 def suffix @suffix end |
.threads ⇒ Object
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
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 |, error| Nagare.logger.error "Failed to process message #{}" Nagare.logger.error error. Nagare.logger.error error.backtrace.join("\n") end @dlq_stream ||= 'dlq' @max_retries ||= 10 self end |