thrift-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ranbir Shoker <ranbir.sho...@nsc.co.uk>
Subject RE: TZlibTransport for RPC?
Date Fri, 29 Nov 2019 10:18:54 GMT
I have found the TFramedZlibTransportFactory class in fbthrift, and created a version of it
locally and confirmed that it does do what I want it to do, so perhaps that is the answer
to my question.

Ranbir Shoker - Principal Software Engineer
Email: ranbir.shoker@nsc.co.uk<mailto:ranbir.shoker@nsc.co.uk>
Skype: nsc.rss

 [http://www.nsc.co.uk/emails/images/nscLogoRect500x96dpi.jpg]
NSC, River View, 2 Meadows Business Park, Camberley, Surrey, GU17 9AB, England
Tel: +44 1276 678867 | Fax: +44 1276 38195 | Web: www.nsc.co.uk<http://www.nsc.co.uk/>
| Twitter: http://twitter.com/nscnews

NSC is a trading name of Newman & Spurr Consultancy Ltd * Registration No. 02250553 *
Registered in England and Wales

The information contained in this email and any attachments is intended for the named addressee(s).
If you are not the named addressee(s) please notify the sender immediately and do not disclose,
copy or distribute the contents to any person other than the intended addressee(s).


From: Ranbir Shoker <ranbir.shoker@nsc.co.uk>
Sent: 29 November 2019 09:03
To: user@thrift.apache.org
Subject: TZlibTransport for RPC?

Hi All

I have somewhat of a basic question which I haven't managed to find any answers to on any
previous posts...

I am tinkering with the Calculator example in C++ using the TThreadedServer, in order to try
and compress the data using TZlibTransport. The client code looks like

  boost::shared_ptr<TTransport> socket(new TSocket("wisedev71", 9090));
  boost::shared_ptr<TTransport> transport(new TBufferedTransport (socket));
  transport.reset(new TZlibTransport(transport));
  boost::shared_ptr<TProtocol> protocol(new TCompactProtocol(transport));
  CalculatorClient client(protocol);

I'm not sure what to do on the server side, since it requires a factory...the current code
looks lije:
  TThreadedServer server(
    boost::make_shared<CalculatorProcessorFactory>(boost::make_shared<CalculatorCloneFactory>()),
    boost::make_shared<TServerSocket>(9090), //port
    boost::make_shared<TBufferedTransportFactory>(),
    boost::make_shared< TCompactProtocolFactory>());

It seems I can't just replace the TBufferedTransportFactory with a TZlibTransportFactory,
since the TZlibTransport needs to wrap another type of transport, and I can't see any way
to tell it what the underlying transport is.

The only examples of TZlibTransport which I have seen are related to using it in the client
fashion above to wrap file transport, and then write out to file. Is what I'm attempting to
do even possible out of the box, i.e. use TZlibTransport for RPC on a TThreadedServer? If
so, are there any examples on how to do it?

Thanks
Ranbir

Ranbir Shoker - Principal Software Engineer
Email: ranbir.shoker@nsc.co.uk<mailto:ranbir.shoker@nsc.co.uk>
Skype: nsc.rss

 [http://www.nsc.co.uk/emails/images/nscLogoRect500x96dpi.jpg]
NSC, River View, 2 Meadows Business Park, Camberley, Surrey, GU17 9AB, England
Tel: +44 1276 678867 | Fax: +44 1276 38195 | Web: www.nsc.co.uk<http://www.nsc.co.uk/>
| Twitter: http://twitter.com/nscnews

NSC is a trading name of Newman & Spurr Consultancy Ltd * Registration No. 02250553 *
Registered in England and Wales

The information contained in this email and any attachments is intended for the named addressee(s).
If you are not the named addressee(s) please notify the sender immediately and do not disclose,
copy or distribute the contents to any person other than the intended addressee(s).


The information contained in this email and any attachments is intended for the named addressee(s).
If you are not the named addressee(s) please notify the sender immediately and do not disclose,
copy or distribute the contents to any person other than the intended addressee(s).

The information contained in this email and any attachments is intended for the named addressee(s).
If you are not the named addressee(s) please notify the sender immediately and do not disclose,
copy or distribute the contents to any person other than the intended addressee(s).

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