From: Chandranshu . <cha...@gm...> - 2008-11-21 12:15:56
|
Resending in plain text format: I'm trying to use a Ruby Client named rscribe_cat.rb to post messages to the scribed server started using the examples/example1.conf file that came with the distribution. The file is attached herewith. I'm summarizing the problems I faced in setting up Scribe for Ruby: 1. Edit the <SCRIBE_BASE>/src/Makefile.in. Replace the following line $(eval $(call thrift_template,.,$(srcdir)/../if/scribe.thrift, -I $(thrift_home)/share/ -I $(fb303_home)/share/ --cpp --py --php)) with $(eval $(call thrift_template,.,$(srcdir)/../if/scribe.thrift, -I $(thrift_home)/share/ -I $(fb303_home)/share/ --cpp --py --php --gen rb)) 2. Now run the following command from <SCRIBE_BASE> again: sudo make install Verify that a gen_rb folder has been created in the <SCRIBE_BASE>/src directory and it contains the scribe.rb file. This file contains the ruby module that'll enable us to use it from inside ruby code. Also, add this path to $: in your Ruby Client. 3. However, the generated module contains the module name as scribe and trying to use it will result in Ruby complaining that ../src/gen-rb/scribe.rb:12: class/module name must be CONSTANT (SyntaxError) The leading ".." is because I was writing the ruby client in the examples directory. Open the "../src/gen-rb/scribe.rb" file and change the module name to be Scribe with a capital 'S'. 4. The next error you'll get is: ../src/gen-rb/scribe.rb:9:in `require': no such file to load -- FacebookService (LoadError) This is because when installing fb303, ruby classes were left out again. Generate the ruby classes for the fb303 service interface from the <FB303_BASE> directory: sudo thrift -o /usr/local/share -I /usr/local/share --gen rb if/fb303.thrift Unfortunately, ruby files in /usr/local/share are not picked up Ruby by default. So, you'll have to manually copy over the files to /usr/local/lib/site_ruby/1.8/ or the corresponding directory on your machine. 5. The next error is the one that consumed most of my time: /usr/local/lib/site_ruby/1.8/fb303_types.rb:8:in `require': no such file to load -- /usr/local/lib/site_ruby/1.8/reflection_limited_types Looking at the code, I found that it was using File.dirname(FILE) to load the reflection_limited_types file. Bad for me. After a huge updatedb call, I was able to locate the corresponding thrift file. Use the following to remedy this: sudo thrift -o /usr/local/lib/site_ruby/1.8 --gen rb /usr/local/share/thrift/if/reflection_limited.thrift and then copy out the files from the gen-rb directory to the /usr/local/lib/site_ruby/1.8 directory. After this point, you shouldn't get any more syntax errors. Though it'd be great if the ruby classes are also generated at the build time for Thrift, fb303 and scribe. I think generating the ruby classes for the thrift/if/reflection_limited.thrift, <fb303_base>/if/fb303.thrift and $(srcdir)/../if/scribe.thrift files and putting them in the right place should do. 6. What I'm still struggling with: /usr/local/lib/site_ruby/1.8/thrift/protocol/binaryprotocol.rb:82:in `read_message_begin': Missing version identifier (Thrift::ProtocolException) from /usr/local/lib/site_ruby/1.8/thrift/client.rb:26:in `receive_message' from ../src/gen-rb/scribe.rb:26:in `recv_Log' from ../src/gen-rb/scribe.rb:18:in `Log' from rscribe_cat:18 If someone has solved this problem or if the developers can guide me as to what might be going wrong, I'll try and fix it and post a patch. Anyways, good framework Guys!! Thanks and regards, Chandranshu |