Class: Katello::Agent::Connection

Inherits:
Object
  • Object
show all
Defined in:
app/lib/katello/agent/connection.rb

Instance Method Summary collapse

Constructor Details

#initializeConnection

Returns a new instance of Connection.



4
5
6
7
8
9
10
11
# File 'app/lib/katello/agent/connection.rb', line 4

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

Instance Method Details

#closeObject



33
34
35
# File 'app/lib/katello/agent/connection.rb', line 33

def close
  @connection.close
end

#delete_client_queue(queue_name) ⇒ Object



21
22
23
# File 'app/lib/katello/agent/connection.rb', line 21

def delete_client_queue(queue_name)
  @connection.delete_queue(queue_name)
end

#fetch_agent_messages(handler = ClientMessageHandler) ⇒ Object



17
18
19
# File 'app/lib/katello/agent/connection.rb', line 17

def fetch_agent_messages(handler = ClientMessageHandler)
  @connection.receive_messages(address: settings[:event_queue_name], handler: handler)
end

#open?Boolean

Returns:

  • (Boolean)


29
30
31
# File 'app/lib/katello/agent/connection.rb', line 29

def open?
  @connection.open?
end

#send_messages(messages) ⇒ Object



13
14
15
# File 'app/lib/katello/agent/connection.rb', line 13

def send_messages(messages)
  @connection.send_messages(messages)
end

#settingsObject



25
26
27
# File 'app/lib/katello/agent/connection.rb', line 25

def settings
  SETTINGS[:katello][:agent]
end