def trigger_callback(meth, wi_or_msg, err=nil)

      wi, msg, err = if err
        [ wi_or_msg['workitem'], wi_or_msg, err ]
      elsif wi_or_msg['workitem']
        [ wi_or_msg['workitem'], wi_or_msg, nil ]
      else
        [ wi_or_msg, nil, nil ]
      end

      pinfo =
        h.participant ||
        @context.plist.lookup_info(h.participant_name, wi)

      pa = @context.plist.instantiate(pinfo, :if_respond_to? => meth)

      return nil unless pa

      args = { 'workitem' => Ruote::Workitem.new(wi) }
      args['error'] = err if err
      args['msg'] = msg if msg

      Ruote.participant_send(pa, meth, args)
    end
def trigger_callback(meth, wi_or_msg, err=nil)

      wi, msg, err = if err
        [ wi_or_msg['workitem'], wi_or_msg, err ]
      elsif wi_or_msg['workitem']
        [ wi_or_msg['workitem'], wi_or_msg, nil ]
      else
        [ wi_or_msg, nil, nil ]
      end

      pinfo =
        h.participant ||
        @context.plist.lookup_info(h.participant_name, wi)

      pa = @context.plist.instantiate(pinfo, :if_respond_to? => meth)

      return nil unless pa

      args = { 'workitem' => Ruote::Workitem.new(wi) }
      args['error'] = err if err
      args['msg'] = msg if msg

      Ruote.participant_send(pa, meth, args)
    end
Used to trigger #on_apply, #on_reply, #on_cancel and #on_error in
 the participant implementation.