Class: ElasticBeans::ConfigurationTemplate::Worker
- Inherits:
-
Base
- Object
- ElasticBeans::ConfigurationTemplate
- Base
- ElasticBeans::ConfigurationTemplate::Worker
- Defined in:
- lib/elastic_beans/configuration_template/worker.rb
Overview
The worker configuration templates stored in the Elastic Beanstalk application. Settings for the worker environments are stored here. This class is used to construct multiple worker configuration templates, one per queue.
Constant Summary
Constants inherited from ElasticBeans::ConfigurationTemplate
SOLUTION_STACK_PATTERN, SOURCE_CONFIGURATION, WORKER_TEMPLATE_NAME_PATTERN
Instance Attribute Summary collapse
-
#queue ⇒ Object
readonly
Returns the value of attribute queue.
Attributes inherited from ElasticBeans::ConfigurationTemplate
Instance Method Summary collapse
-
#environment ⇒ Object
Fetches the running worker environment using the same queue from the application.
-
#initialize(queue:, **args) ⇒ Worker
constructor
A new instance of Worker.
Methods inherited from Base
Methods inherited from ElasticBeans::ConfigurationTemplate
new_by_type, new_from_existing, #option_settings, #options_to_remove, #solution_stack_name, #upsert
Constructor Details
#initialize(queue:, **args) ⇒ Worker
Returns a new instance of Worker.
9 10 11 12 |
# File 'lib/elastic_beans/configuration_template/worker.rb', line 9 def initialize(queue:, **args) @queue = queue super(name: "worker-#{queue}", **args) end |
Instance Attribute Details
#queue ⇒ Object (readonly)
Returns the value of attribute queue.
7 8 9 |
# File 'lib/elastic_beans/configuration_template/worker.rb', line 7 def queue @queue end |
Instance Method Details
#environment ⇒ Object
Fetches the running worker environment using the same queue from the application.
15 16 17 18 19 20 |
# File 'lib/elastic_beans/configuration_template/worker.rb', line 15 def environment if defined? @environment return @environment end @environment = application.environments.find { |environment| environment.is_a?(Environment::Worker) && environment.queue == queue } end |