app/lib/katello/agent/connection.rb in katello-4.0.0.rc3 vs app/lib/katello/agent/connection.rb in katello-4.0.0.rc3.1
- old
+ new
@@ -1,24 +1,38 @@
module Katello
module Agent
class Connection
+ def initialize
+ @connection = ::Katello::Qpid::Connection.new(
+ url: settings[:broker_url],
+ ssl_cert_file: settings[:broker_ssl_cert_file],
+ ssl_key_file: settings[:broker_ssl_key_file],
+ ssl_ca_file: settings[:broker_ssl_ca_file]
+ )
+ end
+
def send_messages(messages)
- connection = ::Katello::Qpid::Connection.new(settings[:broker_url])
- connection.send_messages(messages)
+ @connection.send_messages(messages)
end
def fetch_agent_messages(handler = ClientMessageHandler)
- connection = ::Katello::Qpid::Connection.new(settings[:broker_url])
- connection.receive_messages(address: settings[:event_queue_name], handler: handler)
+ @connection.receive_messages(address: settings[:event_queue_name], handler: handler)
end
def delete_client_queue(queue_name)
- connection = ::Katello::Qpid::Connection.new(settings[:broker_url])
- connection.delete_queue(queue_name)
+ @connection.delete_queue(queue_name)
end
def settings
SETTINGS[:katello][:agent]
+ end
+
+ def open?
+ @connection.open?
+ end
+
+ def close
+ @connection.close
end
end
end
end