Class: MultipleMan::Configuration
- Inherits:
-
Object
- Object
- MultipleMan::Configuration
- Defined in:
- lib/multiple_man/configuration.rb
Instance Attribute Summary collapse
-
#app_name ⇒ Object
Returns the value of attribute app_name.
-
#bunny_opts ⇒ Object
Returns the value of attribute bunny_opts.
-
#connection ⇒ Object
Returns the value of attribute connection.
-
#connection_recovery ⇒ Object
Returns the value of attribute connection_recovery.
-
#enabled ⇒ Object
Returns the value of attribute enabled.
-
#error_handler ⇒ Object
Returns the value of attribute error_handler.
- #logger ⇒ Object
-
#prefetch_size ⇒ Object
Returns the value of attribute prefetch_size.
-
#queue_name ⇒ Object
Returns the value of attribute queue_name.
-
#reraise_errors ⇒ Object
Returns the value of attribute reraise_errors.
-
#subscriber_registry ⇒ Object
readonly
Returns the value of attribute subscriber_registry.
-
#topic_name ⇒ Object
Returns the value of attribute topic_name.
-
#worker_concurrency ⇒ Object
Returns the value of attribute worker_concurrency.
Instance Method Summary collapse
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
- #listeners ⇒ Object
- #on_error(&block) ⇒ Object
- #register_listener(listener) ⇒ Object
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/multiple_man/configuration.rb', line 18 def initialize self.topic_name = "multiple_man" self.app_name = Rails.application.class.parent.to_s if defined?(Rails) self.enabled = true self.worker_concurrency = 1 self.reraise_errors = true self.prefetch_size = 100 self.connection_recovery = { time_before_reconnect: 0.2, time_between_retries: 0.8, max_retries: 5 } self.bunny_opts = {} @subscriber_registry = Subscribers::Registry.new end |
Instance Attribute Details
#app_name ⇒ Object
Returns the value of attribute app_name.
12 13 14 |
# File 'lib/multiple_man/configuration.rb', line 12 def app_name @app_name end |
#bunny_opts ⇒ Object
Returns the value of attribute bunny_opts.
12 13 14 |
# File 'lib/multiple_man/configuration.rb', line 12 def bunny_opts @bunny_opts end |
#connection ⇒ Object
Returns the value of attribute connection.
12 13 14 |
# File 'lib/multiple_man/configuration.rb', line 12 def connection @connection end |
#connection_recovery ⇒ Object
Returns the value of attribute connection_recovery.
12 13 14 |
# File 'lib/multiple_man/configuration.rb', line 12 def connection_recovery @connection_recovery end |
#enabled ⇒ Object
Returns the value of attribute enabled.
12 13 14 |
# File 'lib/multiple_man/configuration.rb', line 12 def enabled @enabled end |
#error_handler ⇒ Object
Returns the value of attribute error_handler.
12 13 14 |
# File 'lib/multiple_man/configuration.rb', line 12 def error_handler @error_handler end |
#logger ⇒ Object
39 40 41 |
# File 'lib/multiple_man/configuration.rb', line 39 def logger @logger ||= defined?(Rails) ? Rails.logger : Logger.new(STDOUT) end |
#prefetch_size ⇒ Object
Returns the value of attribute prefetch_size.
12 13 14 |
# File 'lib/multiple_man/configuration.rb', line 12 def prefetch_size @prefetch_size end |
#queue_name ⇒ Object
Returns the value of attribute queue_name.
12 13 14 |
# File 'lib/multiple_man/configuration.rb', line 12 def queue_name @queue_name end |
#reraise_errors ⇒ Object
Returns the value of attribute reraise_errors.
12 13 14 |
# File 'lib/multiple_man/configuration.rb', line 12 def reraise_errors @reraise_errors end |
#subscriber_registry ⇒ Object (readonly)
Returns the value of attribute subscriber_registry.
11 12 13 |
# File 'lib/multiple_man/configuration.rb', line 11 def subscriber_registry @subscriber_registry end |
#topic_name ⇒ Object
Returns the value of attribute topic_name.
12 13 14 |
# File 'lib/multiple_man/configuration.rb', line 12 def topic_name @topic_name end |
#worker_concurrency ⇒ Object
Returns the value of attribute worker_concurrency.
12 13 14 |
# File 'lib/multiple_man/configuration.rb', line 12 def worker_concurrency @worker_concurrency end |
Instance Method Details
#listeners ⇒ Object
47 48 49 |
# File 'lib/multiple_man/configuration.rb', line 47 def listeners subscriber_registry.subscriptions end |
#on_error(&block) ⇒ Object
43 44 45 |
# File 'lib/multiple_man/configuration.rb', line 43 def on_error(&block) @error_handler = block end |
#register_listener(listener) ⇒ Object
51 52 53 |
# File 'lib/multiple_man/configuration.rb', line 51 def register_listener(listener) subscriber_registry.register(listener) end |