[Backgroundrb-devel] Communicating Worker-to-Worker

Josh Symonds veraticus at gmail.com
Thu Apr 10 09:37:37 EDT 2008

Hi everyone,

I have two workers, a connection_worker and an interface_worker, that I want
to be able to call methods on each other. Initially I thought I could do

  def alive?
    return true

  def test_connection
    if MiddleMan.worker(:connection_worker).alive?(true)
      return true

Obviously this is a somewhat contrived test but I was just trying to make
sure everything worked. I use alive?(true) because, according to
http://backgroundrb.rubyforge.org/rails/index.html, passing true should
cause the worker to wait for a result and return that result. Unfortunately
that doesn't seem to be the cause: every time I run this method I get nil
back from the connection_worker. I know that in this specific case I could
just check whether the connection_worker is running, but what I'm really
trying to test here is how to communicate between the two workers, not
whether the connection_worker is alive.

So I'm wondering what the best way to communicate between these workers is.
I took a look at the advanced stuff and I think that maybe connect and
start_server could work for me, but the documentation on them leaves me
confused as to how to actually implement them. Any suggestions or help would
be much appreciated.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/backgroundrb-devel/attachments/20080410/1018d044/attachment-0001.html 

More information about the Backgroundrb-devel mailing list