lib/ruote/worker.rb
# Processes one msg.
#
# Will return false immediately if the msg reservation failed (another
# worker grabbed the message.
#
# Else will execute the action ordered in the msg, and return true.
#
# Exceptions in execution are intercepted here and passed to the
# engine's (context's) error_handler.
#
Processes one msg.
Will return false immediately if the msg reservation failed (another
worker grabbed the message.

Else will execute the action ordered in the msg, and return true.

Exceptions in execution are intercepted here and passed to the
engine's (context's) error_handler.
Processes one msg . Will return false immediately if the msg reservation failed ( another worker grabbed the message . Else will execute the action ordered in the msg and return true . Exceptions in execution are intercepted here and passed to the engine ' s ( context ' s ) error_handler .
def process(msg)
      return false unless @storage.reserve(msg)
      begin
        @context.pre_notify(msg)
        case msg['action']
          when 'launch', 'apply', 'regenerate'
            launch(msg)
          when *EXP_ACTIONS
            Ruote::Exp::FlowExpression.do_action(@context, msg)
          when *DISP_ACTIONS
            @context.dispatch_pool.handle(msg)
          when *PROC_ACTIONS
            self.send(msg['action'], msg)
          when 'reput'
            reput(msg)
          when 'raise'
            @context.error_handler.msg_handle(msg['msg'], msg['error'])
          when 'respark'
            respark(msg)
        end
        @context.notify(msg)
      rescue => err
        @context.error_handler.msg_handle(msg, err)
      end
      @context.storage.done(msg) if @context.storage.respond_to?(:done)
      @info << msg if @info
      true
    end
def process ( msg ) return false unless @storage . reserve ( msg ) begin @context . pre_notify ( msg ) case msg [ 'action' ] when 'launch' , 'apply' , 'regenerate' launch ( msg ) when * EXP_ACTIONS Ruote :: Exp :: FlowExpression . do_action ( @context , msg ) when * DISP_ACTIONS @context . dispatch_pool . handle ( msg ) when * PROC_ACTIONS self . send ( msg [ 'action' ] , msg ) when 'reput' reput ( msg ) when 'raise' @context . error_handler . msg_handle ( msg [ 'msg' ] , msg [ 'error' ] ) when 'respark' respark ( msg ) end @context . notify ( msg ) rescue => err @context . error_handler . msg_handle ( msg , err ) end @context . storage . done ( msg ) if @context . storage . respond_to? ( :done ) @info << msg if @info true end
Processes one msg.
Processes one msg .
#else # no special processing required for message, let it pass # to the subscribers (the notify two lines after) # notify subscribers of successfully processed msgs # for the stats
msg