Hi, 1. scrooge is able to generate finagle server/client, which may have some advanced features the Apache Thrift don't support. 2. make sure the transport and protocol are the same between the server/client.
On Wed, Jun 1, 2016 at 3:12 PM Jens Geyer <[email protected]> wrote: > Hi, > > from a very quick glance I can't see anything wrong. However I would > recommend to have a look at the tutorial code. It is also a small project > that is known to work. Maybe that helps to locate the issue. > > Have fun, > JensG > ________________________________ > Von: Colin Kincaid Williams > Gesendet: 01.06.2016 03:05 > An: [email protected] > Betreff: help with existing thrift idl > > Hello, > > I'm not really too familiar with thrift, but have used protobuf a > little, and think the general idea is quite similar. Anyhow, I've been > asked to update a thrift project. I found a simple idl definition > like: > > > struct Ainfo > > { > > 1: required string url; > > 2: optional i32 a_rank; > > 3: optional byte generation; > > 4: optional i32 b_type; > > 5: optional string location; > > 6: optional i64 time; > > } > > > service AinfoService > > { > > Ainfo getAinfo( > > 1: required string url > > ), > > > bool insertAinfo( > > 1: Ainfo details > > ), > > Ainfo updateAinfo( > > 1: Ainfo details > > ), > > } > > Then it was simple enough to generate some python client similar to > the documentation at thrift.apache.org. > > thrift --gen py ./api.thrift > > import sys > import glob > sys.path.append('gen-py') > > from thrift import Thrift > from thrift.transport import TSocket > from thrift.transport import TTransport > from thrift.protocol import TBinaryProtocol > > from api import AinfoService > > transport = TSocket.TSocket('thrift_server', 50055) > transport = TTransport.TBufferedTransport(transport) > protocol = TBinaryProtocol.TBinaryProtocol(transport) > client = AinfoService.Client(protocol) > transport.open() > client.getAinfo("http://www.example.com/testurl.htm") > > At this point I'm just waiting for a return value, which doesn't seem > to happen. I can connect to the thrift service via telnet: > > telnet thrift_server 50055 > > Trying thrift_server... > > Connected to thrift_server. > > Escape character is '^]'. > > > > I'm using Apache Thrift v0.9.3 both for thrift --gen py ./api.thrift > and from pip2.7 . The project I'm using looks like they used Scrooge > and Thrift in their maven pom. I plan to move forward using that > project. > > However, I thought the point of using thrift was to be language > agnostic, and so am trying to use python to verify this simple > definition. > > Are scrooge thrift project(s) incompatible with this generator? > > Any ideas on what I should approach next would be appreciated. > -- Best Regards, -- Lixin Yu http://lxyu.net
