Class: Alephant::Broker::ComponentFactory
- Inherits:
-
Object
- Object
- Alephant::Broker::ComponentFactory
- Includes:
- Logger
- Defined in:
- lib/alephant/broker/component_factory.rb
Instance Method Summary collapse
- #create(id, batch_id, options) ⇒ Object
-
#initialize(load_strategy) ⇒ ComponentFactory
constructor
A new instance of ComponentFactory.
Constructor Details
#initialize(load_strategy) ⇒ ComponentFactory
Returns a new instance of ComponentFactory.
11 12 13 |
# File 'lib/alephant/broker/component_factory.rb', line 11 def initialize(load_strategy) @load_strategy = load_strategy end |
Instance Method Details
#create(id, batch_id, options) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/alephant/broker/component_factory.rb', line 15 def create(id, batch_id, ) = ComponentMeta.new(id, batch_id, ) Component.new( , @load_strategy.load() ) rescue Alephant::Broker::Errors::ContentNotFound => e logger.error( method: 'Broker.ComponentFactory.create', message: 'Exception raised (ContentNotFound)', component_key: .component_key ) logger.metric "ContentNotFound" ErrorComponent.new(, 404, e) rescue => e logger.error( method: 'Broker.ComponentFactory.create', message: e., backtrace: e.backtrace.join('\n') ) logger.metric "ExceptionRaised" ErrorComponent.new(, 500, e) end |