thrift-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Martin Hejnfelt ...@newtec.dk>
Subject Example on using TFileTransport
Date Fri, 20 Mar 2009 12:20:36 GMT
Hi,

I'm working on a system that implements Thrift as the main protocol for
connection between the clients and the server, all done in C++.
The thrift service doesn't do much more that give an easy way of moving
some structs to the server.
Now my problem is that I have to find a way to store the information if
the thrift server isn't reachable. I have some structs defined in the
thrift file (which are then mapped to C++ classes) that gets filled with
information and then methods to send these to the server. If the server
is down I'd like to save these classes/thrift-structs  to a file
(serialization I guess), and then load them back into the program, when
the thrift server is back up. First I tried just to use regular istream
and ostream methods of serialization, but as I found out, the success of
this method apparently depends on the compiler (i.e. it doesn't work for
me :). So read in the Thrift whitepaper about this TFileTransport
"option", which seems to be able to do what I need (or maybe I
misunderstood it). It looks like this "layer" is capable of writing
thrift requests to a file, and then actually "replay" it (so I could
replay the requests when the server is back up). However I can't find
any good examples of using it. My question is then (finally :)):
Can someone give me a short example of using this (if a short example is
even possible)?
I guess I "just" need to know how I could add and read events from it,
in order to take an previous event, and "replay" to the client. (I see
it has addEvent and readEvent methods, but how should I use these
compared to/in conjunction with my existing client->DoWhatEverMethod()
calls?

Anyway, any help is appreciated :) Thanks in advance!


Mvh. / Best Regards

Martin Hejnfelt


Mime
View raw message