Hi Rush, That was exactly what I needed! Thanks a lot :) (Of course also thanks to Alexandre Patry)
Mvh. / Best Regards Martin Hejnfelt On Fri, 2009-03-20 at 10:52 -0700, Rush Manbert wrote: > On Mar 20, 2009, at 5:20 AM, Martin Hejnfelt wrote: > > > 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 > > Hi Martin, > > I have attached a zip file that contains the c++ source file I used to > test the file transport sometime last year. I might have hacked their > test program to make it. Note that it includes ThriftTest.h, which is > generated from thriftSrcDistro/test/ThriftTest.thrift. > > As I remember it, the binary and JSON protocols worked just fine. > There might have been an issue with the dense protocol, but I really > don't remember at this point. If you start your testing using the JSON > protocol, it's easy to look at the file that gets written and see > what's there. > > Best regards, > Rush >
