Hi John

Please go through the below code example

class ConvertFiles

def execute
    @pid = spawn(long_running_process)
    Process.wait(@pid)
end

def cancel
  Process.kill 9, @pid
end

end

class ParticipantTest
  include Ruote::LocalParticipant

  def initialize (options)
    @options = options
  end

  def consume (workitem)

   convert = ConvertFiles.new
   ....
   #save convert object_id to database
   convert.execute

    reply_to_engine(workitem)
  end

  def cancel(fei, flavour)
    ...
    #retrieve convert object_id to database
   convert = ObjectSpace._id2ref(convert_objectid)
   convert.cancel

  end

end


prsdef = Ruote.process_definition :name => "Test" do
      sequence do
         participant_test
     end
  end

engine = Ruote::Engine.new(Ruote::Worker.new(Ruote::HashStorage.new))

engine.register_participant  'participant_test', ParticipantTest

wflid = engine.launch(prsdef)
engine.wait_for(wflid)


Thanks,
Rashi

On Thu, Aug 2, 2012 at 6:04 PM, John Mettraux <[email protected]> wrote:

>
> On Thu, Aug 02, 2012 at 05:59:09PM +0530, Rashi Gupta wrote:
> >
> > Solution no 2 worked for me
> >
> > but there was a catch : recycled object error
> >
> > I was saving the object_id of the process handle and using in cancel
> >
> > but sometimes I get Recycled Object error.
> >
> > could you tell me some other workaround for it.
>
> Hello Rashi,
>
> that sounds like a bad idea (to use the object_id)...
>
> I have trouble figuring out how you do it. Can you show me what your code
> looks like (like I did for the solutions in my previous email)?
>
> --
> John Mettraux - http://lambda.io/jmettraux
>
> --
> you received this message because you are subscribed to the "ruote users"
> group.
> to post : send email to [email protected]
> to unsubscribe : send email to
> [email protected]
> more options : http://groups.google.com/group/openwferu-users?hl=en
>

-- 
you received this message because you are subscribed to the "ruote users" group.
to post : send email to [email protected]
to unsubscribe : send email to [email protected]
more options : http://groups.google.com/group/openwferu-users?hl=en

Reply via email to