lib/basquiat/adapters/rabbitmq/configuration.rb in basquiat-1.3.0.pre.1 vs lib/basquiat/adapters/rabbitmq/configuration.rb in basquiat-1.3.0
- old
+ new
@@ -1,29 +1,30 @@
+# frozen_string_literal: true
module Basquiat
module Adapters
class RabbitMq
# Responsible for dealing with the overall configuration of the RabbitMQ adapter
class Configuration
using Basquiat::HashRefinements
def initialize
@options = { connection:
- { hosts: ['localhost'],
- port: 5672,
- auth: { user: 'guest', password: 'guest' }
- },
- queue: {
- name: Basquiat.configuration.queue_name,
+ { hosts: ['localhost'],
+ port: 5672,
+ auth: { user: 'guest', password: 'guest' }
+ },
+ queue: {
+ name: Basquiat.configuration.queue_name,
durable: true,
options: {} },
- exchange: {
- name: Basquiat.configuration.exchange_name,
+ exchange: {
+ name: Basquiat.configuration.exchange_name,
durable: true,
options: {} },
publisher: { confirm: true, persistent: false },
- consumer: { prefetch: 1000, manual_ack: true },
- requeue: { enabled: false } }
+ consumer: { prefetch: 1000, manual_ack: true },
+ requeue: { enabled: false } }
end
def base_options
@options
end
@@ -45,13 +46,13 @@
@options[:connection]
end
# @return [Hash] the session options
def session_options
- { exchange: @options[:exchange],
+ { exchange: @options[:exchange],
publisher: @options[:publisher],
- consumer: @options[:consumer],
- queue: @options[:queue] }.deep_merge(strategy.session_options)
+ consumer: @options[:consumer],
+ queue: @options[:queue] }.deep_merge(strategy.session_options)
end
# @return [BaseStrategy] the requeue strategy or {BasicAcknowledge} if none is configured
def strategy
requeue = @options[:requeue]