thrift-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jens Geyer <jensge...@hotmail.com>
Subject AW: User defined callback
Date Mon, 08 Jul 2013 06:58:30 GMT
Hi,

the recommendations in such cases are typically twofold:
a) run a server instance on the client and let the server establish a normal connection to
the client
b) if the former is not possible for some reasons (eg. firewall rules, ...) use long running
calls. After the server sent a response (=callback) the client immediately starts another
call.

Both approaches have pros and cons.
________________________________
Von: Christopher Jones
Gesendet: 07.07.2013 03:24
An: user@thrift.apache.org
Betreff: Re: User defined callback

My use case is:

I would like each client to register with the server supplying a callback
object.
Then if the server wants to notify all the registered clients of some
change in state it simply calls methods on the callback object.
This provides communication that is initiated from either direction.
The alternative is that the client polls (undesirable) the server for new
events.




On Sat, Jul 6, 2013 at 12:55 PM, Jens Geyer <jensgeyer@hotmail.com> wrote:

> No, this will not work. What exactly is your use case?
> ________________________________
> Von: Christopher Jones
> Gesendet: 06.07.2013 16:23
> An: user@thrift.apache.org
> Betreff: User defined callback
>
> Are user defined callbacks not allowed in thrift or am I doing something
> wrong?
>
>
> // cb.thrift
> service Callback
> {
>   void notify ();
> }
>
> service Registry
> {
>   void addCallback (1: Callback cb);   // line 10
> }
>
>
> % thrift -v -strict --gen cpp ~/Code/tests/cb.thrift
>
> Scanning /Users/chrisj/Code/tests/cb.thrift for includes
> Parsing /Users/chrisj/Code/tests/cb.thrift for types
> [ERROR:/Users/chrisj/Code/tests/cb.thrift:10] (last token was 'Callback')
> Type "Callback" has not been defined.
>

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