Class: Emque::Consuming::Configuration
- Inherits:
-
Object
- Object
- Emque::Consuming::Configuration
- Defined in:
- lib/emque/consuming/configuration.rb
Instance Attribute Summary collapse
-
#adapter ⇒ Object
Returns the value of attribute adapter.
-
#app_name ⇒ Object
Returns the value of attribute app_name.
-
#auto_shutdown ⇒ Object
Returns the value of attribute auto_shutdown.
-
#delayed_message_workers ⇒ Object
Returns the value of attribute delayed_message_workers.
-
#enable_delayed_message ⇒ Object
Returns the value of attribute enable_delayed_message.
- #env ⇒ Object
-
#error_expiration ⇒ Object
Returns the value of attribute error_expiration.
-
#error_handlers ⇒ Object
Returns the value of attribute error_handlers.
-
#error_limit ⇒ Object
Returns the value of attribute error_limit.
- #log_formatter ⇒ Object
- #log_level ⇒ Object
-
#retryable_error_limit ⇒ Object
Returns the value of attribute retryable_error_limit.
-
#retryable_errors ⇒ Object
Returns the value of attribute retryable_errors.
-
#shutdown_handlers ⇒ Object
Returns the value of attribute shutdown_handlers.
-
#socket_path ⇒ Object
Returns the value of attribute socket_path.
-
#status ⇒ Object
Returns the value of attribute status.
-
#status_host ⇒ Object
Returns the value of attribute status_host.
-
#status_port ⇒ Object
Returns the value of attribute status_port.
Instance Method Summary collapse
- #env_var ⇒ Object
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
- #set_adapter(name, options = {}) ⇒ Object
- #to_hsh ⇒ Object (also: #to_h)
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/emque/consuming/configuration.rb', line 13 def initialize @app_name = "" @auto_shutdown = false @delayed_message_workers = 1 @enable_delayed_message = false @error_handlers = [] @error_limit = 5 @error_expiration = 3600 # 60 minutes @log_level = nil @log_formatter = nil @retryable_errors = [] @retryable_error_limit = 3 @status_port = 10000 @status_host = "0.0.0.0" @status = :off # :on @socket_path = "tmp/emque.sock" @shutdown_handlers = [] end |
Instance Attribute Details
#adapter ⇒ Object
Returns the value of attribute adapter.
6 7 8 |
# File 'lib/emque/consuming/configuration.rb', line 6 def adapter @adapter end |
#app_name ⇒ Object
Returns the value of attribute app_name.
6 7 8 |
# File 'lib/emque/consuming/configuration.rb', line 6 def app_name @app_name end |
#auto_shutdown ⇒ Object
Returns the value of attribute auto_shutdown.
6 7 8 |
# File 'lib/emque/consuming/configuration.rb', line 6 def auto_shutdown @auto_shutdown end |
#delayed_message_workers ⇒ Object
Returns the value of attribute delayed_message_workers.
6 7 8 |
# File 'lib/emque/consuming/configuration.rb', line 6 def @delayed_message_workers end |
#enable_delayed_message ⇒ Object
Returns the value of attribute enable_delayed_message.
6 7 8 |
# File 'lib/emque/consuming/configuration.rb', line 6 def @enable_delayed_message end |
#env ⇒ Object
32 33 34 |
# File 'lib/emque/consuming/configuration.rb', line 32 def env Emque::Consuming.application.emque_env end |
#error_expiration ⇒ Object
Returns the value of attribute error_expiration.
6 7 8 |
# File 'lib/emque/consuming/configuration.rb', line 6 def error_expiration @error_expiration end |
#error_handlers ⇒ Object
Returns the value of attribute error_handlers.
6 7 8 |
# File 'lib/emque/consuming/configuration.rb', line 6 def error_handlers @error_handlers end |
#error_limit ⇒ Object
Returns the value of attribute error_limit.
6 7 8 |
# File 'lib/emque/consuming/configuration.rb', line 6 def error_limit @error_limit end |
#log_formatter ⇒ Object
44 45 46 |
# File 'lib/emque/consuming/configuration.rb', line 44 def log_formatter @log_formatter ||= ::Logger::Formatter.new end |
#log_level ⇒ Object
40 41 42 |
# File 'lib/emque/consuming/configuration.rb', line 40 def log_level @log_level ||= Logger::INFO end |
#retryable_error_limit ⇒ Object
Returns the value of attribute retryable_error_limit.
6 7 8 |
# File 'lib/emque/consuming/configuration.rb', line 6 def retryable_error_limit @retryable_error_limit end |
#retryable_errors ⇒ Object
Returns the value of attribute retryable_errors.
6 7 8 |
# File 'lib/emque/consuming/configuration.rb', line 6 def retryable_errors @retryable_errors end |
#shutdown_handlers ⇒ Object
Returns the value of attribute shutdown_handlers.
6 7 8 |
# File 'lib/emque/consuming/configuration.rb', line 6 def shutdown_handlers @shutdown_handlers end |
#socket_path ⇒ Object
Returns the value of attribute socket_path.
6 7 8 |
# File 'lib/emque/consuming/configuration.rb', line 6 def socket_path @socket_path end |
#status ⇒ Object
Returns the value of attribute status.
6 7 8 |
# File 'lib/emque/consuming/configuration.rb', line 6 def status @status end |
#status_host ⇒ Object
Returns the value of attribute status_host.
6 7 8 |
# File 'lib/emque/consuming/configuration.rb', line 6 def status_host @status_host end |
#status_port ⇒ Object
Returns the value of attribute status_port.
6 7 8 |
# File 'lib/emque/consuming/configuration.rb', line 6 def status_port @status_port end |
Instance Method Details
#env_var ⇒ Object
36 37 38 |
# File 'lib/emque/consuming/configuration.rb', line 36 def env_var @env end |
#set_adapter(name, options = {}) ⇒ Object
48 49 50 |
# File 'lib/emque/consuming/configuration.rb', line 48 def set_adapter(name, = {}) @adapter = Emque::Consuming::Adapter.new(name, ) end |
#to_hsh ⇒ Object Also known as: to_h
52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 |
# File 'lib/emque/consuming/configuration.rb', line 52 def to_hsh {}.tap { |config| [ :app_name, :adapter, :auto_shutdown, :delayed_message_workers, :env, :enable_delayed_message, :error_handlers, :error_limit, :error_expiration, :log_level, :retryable_errors, :retryable_error_limit, :status_port, :status_host, :status, :socket_path, :shutdown_handlers ].each { |attr| config[attr] = send(attr) } } end |