On Thu, Aug 11, 2011 at 12:54:35AM -0700, Tom wrote:
>
> Of course... that makes perfect sense!
> But since we're using storage participants for all the hard work, we'd
> have to overwrite #consume (correct me if I'm wrong!) - that shouldn't
> be an issue though...

Yes, vanilla OOP.

Those techniques only work if you have one worker in the same Ruby runtime has 
your web server.

There is another trick, you could look at

  
https://github.com/jmettraux/ruote/blob/v2.2.0/lib/ruote/log/default_history.rb

and write something like

---8<---
class MyWatcher
  def initialize(context)
    @context = context
    @context.worker.subscribe(:all, self) if @context.worker
  end
  def notify(msg)
    return unless msg['action'] == 'dispatch'
    # hey, it seems someone will receive a workitem...
  end
end

# ...

opts = {
  's_watcher' => [ 'path/to/my_watcher.rb', 'MyWatcher' ]
}

RuoteKit.engine = Ruote::Engine.new(
  Ruote::Worker.new(
    WhateverStorage.new(x, y, z, opts)))
--->8---

Warning: the upcoming ruote 2.2.1 will changes notify(msg) to on_msg(msg) and 
drops the need for explicitely subscribing.

If you search this mailing list archive for history, you might find about 
previous answers to this question.


Hope this helps, best regards,

--
John Mettraux - http://lambda.io/processi

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