Class: Outboxable::Configuration
- Inherits:
-
Object
- Object
- Outboxable::Configuration
- Defined in:
- lib/outboxable/configuration.rb
Constant Summary collapse
- ALLOWED_MESSAGE_BROKERS =
%i[rabbitmq].freeze
- ALLOWED_ORMS =
%i[activerecord mongoid].freeze
Instance Attribute Summary collapse
-
#message_broker ⇒ Object
Returns the value of attribute message_broker.
-
#orm ⇒ Object
Returns the value of attribute orm.
-
#rabbitmq_exchange_name ⇒ Object
Returns the value of attribute rabbitmq_exchange_name.
-
#rabbitmq_host ⇒ Object
Returns the value of attribute rabbitmq_host.
-
#rabbitmq_password ⇒ Object
Returns the value of attribute rabbitmq_password.
-
#rabbitmq_port ⇒ Object
Returns the value of attribute rabbitmq_port.
-
#rabbitmq_user ⇒ Object
Returns the value of attribute rabbitmq_user.
-
#rabbitmq_vhost ⇒ Object
Returns the value of attribute rabbitmq_vhost.
Instance Method Summary collapse
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/outboxable/configuration.rb', line 24 def initialize raise Error, 'Sidekiq is not available. Unfortunately, sidekiq must be available for Outboxable to work' unless Object.const_defined?('Sidekiq') raise Error, 'Outboxable Gem only supports Rails but you application does not seem to be a Rails app' unless Object.const_defined?('Rails') raise Error, 'Outboxable Gem only support Rails version 7 and newer' if Rails::VERSION::MAJOR < 7 raise Error, 'Outboxable Gem uses the sidekiq-cron Gem. Make sure you add it to your project' unless Object.const_defined?('Sidekiq::Cron') # In accordance to sidekiq-cron README: https://github.com/sidekiq-cron/sidekiq-cron#under-the-hood Sidekiq::Options[:cron_poll_interval] = 5 # Create the cron job for the polling publisher Sidekiq::Cron::Job.create(name: 'OutboxablePollingPublisher', cron: '*/5 * * * * *', class: 'Outboxable::PollingPublisherWorker') end |
Instance Attribute Details
#message_broker ⇒ Object
Returns the value of attribute message_broker.
15 16 17 |
# File 'lib/outboxable/configuration.rb', line 15 def @message_broker end |
#orm ⇒ Object
Returns the value of attribute orm.
15 16 17 |
# File 'lib/outboxable/configuration.rb', line 15 def orm @orm end |
#rabbitmq_exchange_name ⇒ Object
Returns the value of attribute rabbitmq_exchange_name.
15 16 17 |
# File 'lib/outboxable/configuration.rb', line 15 def rabbitmq_exchange_name @rabbitmq_exchange_name end |
#rabbitmq_host ⇒ Object
Returns the value of attribute rabbitmq_host.
15 16 17 |
# File 'lib/outboxable/configuration.rb', line 15 def rabbitmq_host @rabbitmq_host end |
#rabbitmq_password ⇒ Object
Returns the value of attribute rabbitmq_password.
15 16 17 |
# File 'lib/outboxable/configuration.rb', line 15 def rabbitmq_password @rabbitmq_password end |
#rabbitmq_port ⇒ Object
Returns the value of attribute rabbitmq_port.
15 16 17 |
# File 'lib/outboxable/configuration.rb', line 15 def rabbitmq_port @rabbitmq_port end |
#rabbitmq_user ⇒ Object
Returns the value of attribute rabbitmq_user.
15 16 17 |
# File 'lib/outboxable/configuration.rb', line 15 def rabbitmq_user @rabbitmq_user end |
#rabbitmq_vhost ⇒ Object
Returns the value of attribute rabbitmq_vhost.
15 16 17 |
# File 'lib/outboxable/configuration.rb', line 15 def rabbitmq_vhost @rabbitmq_vhost end |