Class: AdvancedSneakersActiveJob::Configuration
- Inherits:
-
Object
- Object
- AdvancedSneakersActiveJob::Configuration
- Includes:
- ActiveSupport::Configurable
- Defined in:
- lib/advanced_sneakers_activejob/configuration.rb
Overview
Advanced Sneakers adapter allows to patch Sneakers with custom configuration. It is useful when already have Sneakers workers running and you want to run ActiveJob Sneakers process with another options.
Constant Summary collapse
- DEFAULT_SNEAKERS_CONFIG =
{ exchange: 'activejob', handler: AdvancedSneakersActiveJob::Handler }.freeze
Instance Method Summary collapse
- #publisher_config ⇒ Object
- #republish_connection=(_) ⇒ Object
- #sneakers ⇒ Object
- #sneakers=(custom) ⇒ Object
Instance Method Details
#publisher_config ⇒ Object
41 42 43 |
# File 'lib/advanced_sneakers_activejob/configuration.rb', line 41 def publisher_config sneakers.merge(publish_connection: publish_connection) end |
#republish_connection=(_) ⇒ Object
23 24 25 |
# File 'lib/advanced_sneakers_activejob/configuration.rb', line 23 def republish_connection=(_) ActiveSupport::Deprecation.warn('Republish connection is not used for bunny-publisher v0.2+') end |
#sneakers ⇒ Object
27 28 29 30 31 32 33 34 35 |
# File 'lib/advanced_sneakers_activejob/configuration.rb', line 27 def sneakers custom_config = DEFAULT_SNEAKERS_CONFIG.deep_merge(config.sneakers || {}) if custom_config[:amqp].present? & custom_config[:vhost].nil? custom_config[:vhost] = AMQ::Settings.parse_amqp_url(custom_config[:amqp]).fetch(:vhost, '/') end Sneakers::CONFIG.to_hash.deep_merge(custom_config) end |
#sneakers=(custom) ⇒ Object
37 38 39 |
# File 'lib/advanced_sneakers_activejob/configuration.rb', line 37 def sneakers=(custom) config.sneakers = custom end |