vendor/bundle/ruby/1.8/gems/emissary-1.3.18/lib/emissary.rb
def dispatch message, config, *args
      unless message.is_a? Emissary::Message
        raise ArgumentError, "message is not an Emissary::Message" 
      end
      
      begin
        agent_type = 'Emissary::Agent::' + message.agent.to_s.capitalize
        begin
          require_klass agent_type 
        rescue LoadError => e
          begin
            require_klass Emissary::EXTERNAL_AGENTS + '::' + message.agent.to_s.capitalize
          rescue LoadError
            # raise the original exception if we still haven't found the file
            raise e
          end
        end
      rescue Exception => e
        Emissary.logger.error "Dispatcher Error: #{e.class.name}: #{e.message}\n\t#{e.backtrace.join("\n\t")}"
        message = message.error(e)
        agent_type = 'Emissary::Agent::Error'
      end
  
      handler = klass_const agent_type, true
      
      klass = klass_from_handler(Agent, handler, message, config, *args)
  
      Emissary.logger.debug " [--] Dispatching message to: #{agent_type}"
      agent = klass.new(message, config, *args)
      block_given? and yield agent
      agent
    end
# Dispatches a message to the agent specified by the message
#
Dispatches a message to the agent specified by the message
Dispatches a message to the agent specified by the message
def dispatch message, config, *args
      unless message.is_a? Emissary::Message
        raise ArgumentError, "message is not an Emissary::Message" 
      end
      begin
        agent_type = 'Emissary::Agent::' + message.agent.to_s.capitalize
        begin
          require_klass agent_type 
        rescue LoadError => e
          begin
            require_klass Emissary::EXTERNAL_AGENTS + '::' + message.agent.to_s.capitalize
          rescue LoadError
            raise e
          end
        end
      rescue Exception => e
        Emissary.logger.error "Dispatcher Error: #{e.class.name}: #{e.message}\n\t#{e.backtrace.join("\n\t")}"
        message = message.error(e)
        agent_type = 'Emissary::Agent::Error'
      end
      handler = klass_const agent_type, true
      klass = klass_from_handler(Agent, handler, message, config, *args)
      Emissary.logger.debug " [--] Dispatching message to: #{agent_type}"
      agent = klass.new(message, config, *args)
      block_given? and yield agent
      agent
    end
def dispatch message , config , * args unless message . is_a? Emissary :: Message raise ArgumentError , "message is not an Emissary::Message" end begin agent_type = 'Emissary::Agent::' + message . agent . to_s . capitalize begin require_klass agent_type rescue LoadError => e begin require_klass Emissary :: EXTERNAL_AGENTS + '::' + message . agent . to_s . capitalize rescue LoadError raise e end end rescue Exception => e Emissary . logger . error "Dispatcher Error: #{e.class.name}: #{e.message}\n\t#{e.backtrace.join("\n\t")}" message = message . error ( e ) agent_type = 'Emissary::Agent::Error' end handler = klass_const agent_type , true klass = klass_from_handler ( Agent , handler , message , config , * args ) Emissary . logger . debug " [--] Dispatching message to: #{agent_type}" agent = klass . new ( message , config , * args ) block_given? and yield agent agent end
Dispatches a message to the agent specified by the message
Dispatches a message to the agent specified by the message
# raise the original exception if we still haven't found the file
message
config
args