On Thu, Jun 17, 2010 at 02:25:36AM -0700, Matt Nichols wrote:
>
> How do I go about running multiple workers when I have remote
> participants. It seems the only way to register participants is via an
> engine instance. Is it acceptable to have multiple engines as well? I
> may be missing something. Here's an example of what I'm trying to
> do...
>
> (...)
>
> # Register participants
> @engine.register_participant(:tagging,
> RuoteAMQP::Participant.new( :default_queue =>
> 'remote_participant_queue' ))
> 
> # Run
> @worker.run
> 
> # In another ruby process run just a worker...
> 
> @worker = Ruote::Worker.new(Ruote::FsStorage.new('/ruote_work'))
> @worker.run
> 
> # This will fail because the worker has no knowledge of the :tagging
> participant.

Hello Matt,

you're right, since the participant :tagging is instantiated at registration 
time, it's only known by the ruby process where the registration happened.

To have a participant which is known to all workers :

---8<---
@engine.register_participant(
  :tagging,
  RuoteAMQP::Participant,
  'default_queue => 'remote_participant_queue')
--->8---


> -----------------------------------------------------------------------------
> Can I just do this?
> -----------------------------------------------------------------------------
> 
> @worker = Ruote::Worker.new(Ruote::FsStorage.new('/ruote_work'))
> @engine = Ruote::Engine.new(@worker, false)
> 
> #
> # Omit the listener setup
> #
> 
> # Register participants
> @engine.register_participant(:tagging,
> RuoteAMQP::Participant.new( :default_queue =>
> 'remote_participant_queue' ))
> 
> # Run
> @worker.run

It could work as well, but the "stateless" registration described above is the 
recommended way.


Best regards,

-- 
John Mettraux - http://jmettraux.wordpress.com

-- 
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