Class: Katello::Agent::Dispatcher
- Inherits:
-
Object
- Object
- Katello::Agent::Dispatcher
- Defined in:
- app/services/katello/agent/dispatcher.rb
Class Method Summary collapse
- .create_histories(host_ids:) ⇒ Object
- .delete_client_queue(queue_name:) ⇒ Object
- .dispatch(message_type, histories, args) ⇒ Object
- .host_queue_name(host) ⇒ Object
- .register_message(name, klass) ⇒ Object
- .settings ⇒ Object
Class Method Details
.create_histories(host_ids:) ⇒ Object
35 36 37 38 39 40 41 42 43 |
# File 'app/services/katello/agent/dispatcher.rb', line 35 def self.create_histories(host_ids:) histories = host_ids.map do |id| Katello::Agent::DispatchHistory.new(host_id: id) end Katello::Agent::DispatchHistory.import(histories) histories end |
.delete_client_queue(queue_name:) ⇒ Object
45 46 47 48 |
# File 'app/services/katello/agent/dispatcher.rb', line 45 def self.delete_client_queue(queue_name:) connection = Connection.new connection.delete_client_queue(queue_name) end |
.dispatch(message_type, histories, args) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'app/services/katello/agent/dispatcher.rb', line 17 def self.dispatch(, histories, args) = [] fail("Unsupported message type: #{message_type}") unless = histories.map do |history| = .new(**args.merge(consumer_id: history.host.subscription_facet.uuid)) .dispatch_history_id = history.id .recipient_address = settings[:client_queue_format] % history.host.subscription_facet.uuid .reply_to = settings[:event_queue_name] end connection = Connection.new connection.() histories end |
.host_queue_name(host) ⇒ Object
50 51 52 53 |
# File 'app/services/katello/agent/dispatcher.rb', line 50 def self.host_queue_name(host) uuid = host.content_facet.uuid settings[:client_queue_format] % uuid end |
.register_message(name, klass) ⇒ Object
6 7 8 |
# File 'app/services/katello/agent/dispatcher.rb', line 6 def self.(name, klass) [name] = klass end |
.settings ⇒ Object
55 56 57 |
# File 'app/services/katello/agent/dispatcher.rb', line 55 def self.settings SETTINGS[:katello][:agent] end |