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.
-
#exchange_opts ⇒ Object
Returns the value of attribute exchange_opts.
- #logger ⇒ Object
-
#prefetch_size ⇒ Object
Returns the value of attribute prefetch_size.
-
#publisher_confirms ⇒ Object
Returns the value of attribute publisher_confirms.
-
#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.
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/multiple_man/configuration.rb', line 19 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 = {} self.exchange_opts = {} self.publisher_confirms = false @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 |
#exchange_opts ⇒ Object
Returns the value of attribute exchange_opts.
12 13 14 |
# File 'lib/multiple_man/configuration.rb', line 12 def exchange_opts @exchange_opts end |
#logger ⇒ Object
42 43 44 |
# File 'lib/multiple_man/configuration.rb', line 42 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 |
#publisher_confirms ⇒ Object
Returns the value of attribute publisher_confirms.
12 13 14 |
# File 'lib/multiple_man/configuration.rb', line 12 def publisher_confirms @publisher_confirms 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
50 51 52 |
# File 'lib/multiple_man/configuration.rb', line 50 def listeners subscriber_registry.subscriptions end |
#on_error(&block) ⇒ Object
46 47 48 |
# File 'lib/multiple_man/configuration.rb', line 46 def on_error(&block) @error_handler = block end |
#register_listener(listener) ⇒ Object
54 55 56 |
# File 'lib/multiple_man/configuration.rb', line 54 def register_listener(listener) subscriber_registry.register(listener) end |