lib/ruote/util/process_observer.rb
def route(time, msg)

      action = msg['action']

      return if @filtered_actions.include?(action)

      callback = [ 'on', time, action ].compact.join('_')

      return unless self.respond_to?(callback)

      wfid  = msg['wfid']
      child = false

      if !wfid && msg['parent_id']
        wfid  = msg['parent_id']['wfid']
        child = true
      end

      wfid ||= Ruote.extract_wfid(msg)
      return if !wfid

      info = {
        :workitem  => msg['workitem'] || {},
        :action    => action,
        :child     => child,
        :variables => msg['variables'],
      }

      # change info based on the action

      case action

        when 'launch'

          info[:pdef] = msg['tree']

        when 'cancel'

          info[:flavour] = msg['flavour']

        when 'error_intercepted'

          error_class = Kernel.const_get(msg['error']['class'])
          begin
            error = error_class.new(msg['error']['message'])
          rescue
            error = Ruote::ProcessObserver::Error.new(error_class, msg['error']['message'])
          end
          error.set_backtrace(msg['error']['trace'])

          info[:error] = error

          info[:workitem] = msg['msg']['workitem']
      end

      info[:workitem] = Ruote::Workitem.new(info[:workitem])

      args = [ wfid ]
      args << info if self.method(callback).arity.abs == 2

      self.send(callback, *args)

    rescue
      # swallow any StandardError
    end
# This error is used when handling an 'error_intercepted' message when we're
# unable to recreate the original exception by passing the error message as
# the only argument to the constructor (i.e. the call to 'new').  Some
# exception classes require different arguments on their constructor.
#
This error is used when handling an 'error_intercepted' message when we're
unable to recreate the original exception by passing the error message as
the only argument to the constructor .  Some
exception classes require different arguments on their constructor.
This error is used when handling an ' error_intercepted ' message when we ' re unable to recreate the original exception by passing the error message as the only argument to the constructor . Some exception classes require different arguments on their constructor .
def route(time, msg)
      action = msg['action']
      return if @filtered_actions.include?(action)
      callback = [ 'on', time, action ].compact.join('_')
      return unless self.respond_to?(callback)
      wfid  = msg['wfid']
      child = false
      if !wfid && msg['parent_id']
        wfid  = msg['parent_id']['wfid']
        child = true
      end
      wfid ||= Ruote.extract_wfid(msg)
      return if !wfid
      info = {
        :workitem  => msg['workitem'] || {},
        :action    => action,
        :child     => child,
        :variables => msg['variables'],
      }
      case action
        when 'launch'
          info[:pdef] = msg['tree']
        when 'cancel'
          info[:flavour] = msg['flavour']
        when 'error_intercepted'
          error_class = Kernel.const_get(msg['error']['class'])
          begin
            error = error_class.new(msg['error']['message'])
          rescue
            error = Ruote::ProcessObserver::Error.new(error_class, msg['error']['message'])
          end
          error.set_backtrace(msg['error']['trace'])
          info[:error] = error
          info[:workitem] = msg['msg']['workitem']
      end
      info[:workitem] = Ruote::Workitem.new(info[:workitem])
      args = [ wfid ]
      args << info if self.method(callback).arity.abs == 2
      self.send(callback, *args)
    rescue
    end
def route ( time , msg ) action = msg [ 'action' ] return if @filtered_actions . include? ( action ) callback = [ 'on' , time , action ] . compact . join ( '_' ) return unless self . respond_to? ( callback ) wfid = msg [ 'wfid' ] child = false if ! wfid && msg [ 'parent_id' ] wfid = msg [ 'parent_id' ] [ 'wfid' ] child = true end wfid ||= Ruote . extract_wfid ( msg ) return if ! wfid info = { :workitem => msg [ 'workitem' ] || { } , :action => action , :child => child , :variables => msg [ 'variables' ] , } case action when 'launch' info [ :pdef ] = msg [ 'tree' ] when 'cancel' info [ :flavour ] = msg [ 'flavour' ] when 'error_intercepted' error_class = Kernel . const_get ( msg [ 'error' ] [ 'class' ] ) begin error = error_class . new ( msg [ 'error' ] [ 'message' ] ) rescue error = Ruote :: ProcessObserver :: Error . new ( error_class , msg [ 'error' ] [ 'message' ] ) end error . set_backtrace ( msg [ 'error' ] [ 'trace' ] ) info [ :error ] = error info [ :workitem ] = msg [ 'msg' ] [ 'workitem' ] end info [ :workitem ] = Ruote :: Workitem . new ( info [ :workitem ] ) args = [ wfid ] args << info if self . method ( callback ) . arity . abs == 2 self . send ( callback , * args ) rescue end
This error is used when handling an 'error_intercepted' message when we're
unable to recreate the original exception by passing the error message as
the only argument to the constructor (i.e.
This error is used when handling an ' error_intercepted ' message when we ' re unable to recreate the original exception by passing the error message as the only argument to the constructor ( i . e .
# change info based on the action # swallow any StandardError
time
msg