lib/msgr/client.rb in msgr-1.3.1 vs lib/msgr/client.rb in msgr-1.3.2

- old
+ new

@@ -19,11 +19,11 @@ @config.merge! parse(config.delete(:uri)) if config[:uri] @config.merge! config.symbolize_keys @mutex = ::Mutex.new - @routes = Routes.new + @routes = load_routes @pid ||= ::Process.pid log(:debug) { "Created new client on process ##{@pid}..." } end @@ -57,12 +57,10 @@ check_process! return if connection.running? log(:debug) { "Start on #{uri}..." } - @routes << config[:routing_file] if config[:routing_file].present? - @routes.reload connection.bind(@routes) end end def connect @@ -189,8 +187,15 @@ config[:port] ||= uri.port if uri.port config[:vhost] ||= uri.path unless uri.path.empty? config[:ssl] ||= uri.scheme.casecmp('amqps').zero? config + end + + def load_routes + Routes.new.tap do |routes| + routes << config[:routing_file] if config[:routing_file].present? + routes.reload + end end end end