# File lib/puppet/application/queue.rb, line 40
40:   def main
41:     require 'puppet/indirector/catalog/queue' # provides Puppet::Indirector::Queue.subscribe
42:     Puppet.notice "Starting puppetqd #{Puppet.version}"
43:     Puppet::Resource::Catalog::Queue.subscribe do |catalog|
44:       # Once you have a Puppet::Resource::Catalog instance, calling save on it should suffice
45:       # to put it through to the database via its active_record indirector (which is determined
46:       # by the terminus_class = :active_record setting above)
47:       Puppet::Util.benchmark(:notice, "Processing queued catalog for #{catalog.name}") do
48:         begin
49:           catalog.save
50:         rescue => detail
51:           puts detail.backtrace if Puppet[:trace]
52:           Puppet.err "Could not save queued catalog for #{catalog.name}: #{detail}"
53:         end
54:       end
55:     end
56: 
57:     Thread.list.each { |thread| thread.join }
58:   end