thrift-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jens Geyer <jensge...@hotmail.com>
Subject AW: help with existing thrift idl
Date Wed, 01 Jun 2016 07:11:39 GMT
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: user@thrift.apache.org
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.

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message