Exception: Nezu::Runtime::RecipientError

Inherits:
RuntimeError
  • Object
show all
Defined in:
lib/nezu/runtime/recipient.rb

Class Method Summary collapse

Class Method Details

.does_not_exist(q) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/nezu/runtime/recipient.rb', line 10

def self.does_not_exist(q)
  klass = q.sub(/^#{Nezu::Config.amqp.development.queue_prefix}./, '').sub(/.#{Nezu::Config.amqp.development.queue_postfix}$/,'').classify
  all_producers = Nezu::Runtime::Producer.descendants.inject({}) {|accu, producer| accu.merge({producer.name => producer.queue_name})}

  message = %Q(

    I couldn't find the queue "#{q}" anywhere in the producers.
    Please create one in \"app/producers/#{klass.underscore}.rb\" with the content of at least:
    -----------8<-----------8<-----------8<-----------
    class #{klass} < Nezu::Runtime::Producer
    end
    ----------->8----------->8----------->8-----------
    These are the producers i've got:


  ).gsub(/^\s*/, '')
  all_producers.each do |p,q|
    message << %Q(class: "#{p}" queue_name:  "#{q}"\n)
  end
  self.new(message)
end