[Backgroundrb-devel] Communicating Worker-to-Worker

Todd Willey todd at rubidine.com
Thu Apr 10 13:54:55 EDT 2008


I think you can use (nil, true) as your arguments, or call
MiddleMan.send_request(...).

The RailsWorkerProxy takes the first argument as the argument to pass to the
method alive, and the second argument to be the synchronous flag.  See
RailsWorkerProxy#method_missing.

-todd[1]

On Thu, Apr 10, 2008 at 1:37 PM, Josh Symonds <veraticus at gmail.com> wrote:

> 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 this:
>
> connection_worker
>   def alive?
>     return true
>   end
> end
>
> interface_worker
>   def test_connection
>     if MiddleMan.worker(:connection_worker).alive?(true)
>       return true
>     end
>   end
> end
>
> 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.
>
> Josh
>
> _______________________________________________
> Backgroundrb-devel mailing list
> Backgroundrb-devel at rubyforge.org
> http://rubyforge.org/mailman/listinfo/backgroundrb-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/backgroundrb-devel/attachments/20080410/ce8c2390/attachment.html 


More information about the Backgroundrb-devel mailing list