For standalone mode you have to do something like this:
MiddleMan = BackgrounDRb::MiddleManDRbObject.init(:uri
=>''drbunix:///
tmp/backgroundrbunix_localhost_2000'')
MiddleMan.new_worker
-Ezra
On Mar 1, 2007, at 11:02 PM, David Gurba wrote:
> Hello,
>
> Trying to get the example to work in standalone mode. I have the
> following in a file and am not certain why I get this undefined
> method error:
>
> error:
> ~/ruby sample_app.rb
> my sample app :)
> sample_app.rb:9: undefined method `new_worker'' for
> BackgrounDRb::MiddleMan:Class (NoMethodError)
>
> ### code follows ###
> # sample_app ... try to get stand-alone happiness.
> #require ''release-0.2.1/lib/backgroundrb''
> #MiddleManDRbObject.init(:uri =>''drbunix:///tmp/
> backgroundrbunix_localhost_2000'')
>
> require ''backgroundrb/middleman''
> include BackgrounDRb
> puts ''my sample app :)''
>
> key = MiddleMan.new_worker(:class => :example_worker)
> worker = MiddleMan.worker(key)
> worker.other_method
> worker.delete
>
> # now that my job is done (and my worker is actually deleted on the
> server) view
> # my results ... cause now I''lm interested.
> p worker.results.to_hash
> puts ''bye bye :)''
>
> I kinda confused because most of the examples online and in /
> examples assume that one is using Rails for this. Its kind of
> difficult to see exactly where require or init calls need to go.
>
> regards,
> David G.
>
>
> _______________________________________________
> Backgroundrb-devel mailing list
> Backgroundrb-devel at rubyforge.org
> http://rubyforge.org/mailman/listinfo/backgroundrb-devel
-- Ezra Zygmuntowicz
-- Lead Rails Evangelist
-- ez at engineyard.com
-- Engine Yard, Serious Rails Hosting
-- (866) 518-YARD (9273)