Class: XmlConv::Util::PollingManager
- Inherits:
-
Object
- Object
- XmlConv::Util::PollingManager
- Defined in:
- lib/xmlconv/util/polling_manager.rb
Instance Method Summary collapse
-
#initialize(system) ⇒ PollingManager
constructor
A new instance of PollingManager.
- #load_sources(&block) ⇒ Object
- #poll_sources ⇒ Object
Constructor Details
#initialize(system) ⇒ PollingManager
Returns a new instance of PollingManager.
172 173 174 |
# File 'lib/xmlconv/util/polling_manager.rb', line 172 def initialize(system) @system = system end |
Instance Method Details
#load_sources(&block) ⇒ Object
175 176 177 178 179 180 181 182 |
# File 'lib/xmlconv/util/polling_manager.rb', line 175 def load_sources(&block) file = File.open(CONFIG.polling_file) YAML.load_documents(file) { |mission| block.call(mission) } ensure file.close if(file) end |
#poll_sources ⇒ Object
183 184 185 186 187 188 189 190 191 192 193 194 195 |
# File 'lib/xmlconv/util/polling_manager.rb', line 183 def poll_sources load_sources { |source| begin source.poll { |transaction| @system.execute(transaction) } rescue Exception => e subject = 'XmlConv2 - Polling-Error' body = [e.class, e.].concat(e.backtrace).join("\n") Util::Mail.notify source.error_recipients, subject, body end } end |