Module: ActionSubscriber::DefaultRouting

Included in:
Base
Defined in:
lib/action_subscriber/default_routing.rb

Instance Method Summary collapse

Instance Method Details

#routes(route_settings) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/action_subscriber/default_routing.rb', line 3

def routes(route_settings)
  @routes ||= begin
    routes = []
    exchange_names.each do |exchange_name|
      subscribable_methods.each do |method_name|
        settings = {
          acknowledgements: acknowledge_messages?,
          action: method_name,
          durable: false,
          exchange: exchange_name,
          routing_key: routing_key_name_for_method(method_name),
          subscriber: self,
          queue: queue_name_for_method(method_name),
        }
        settings.merge!(route_settings)
        routes << ActionSubscriber::Route.new(settings)
      end
    end
    routes
  end
end