The second method requires you to have both a Thrift client and a Thrift server on both sides of the connection.
So in your current implementation, "Alice" has a client, and connects to "Bob's" server. If you wanted Bob to initiate a message, then you can change your implementation to something like the following: Bob creates a Thrift server. Alice creates a Thrift server. Alice creates a Thrift client, and connects to Bob. Alice sends a message containing connection information (e.g. hostname and port) to Bob. Bob takes the connection information, creates a Thrift client, and connects to Alice with the provided information. When Bob notices an event, he sends a message on his Thrift client. [email protected] wrote on 12/10/2013 11:16:58 AM: > From: Onorato Vaticone <[email protected]> > To: [email protected], > Date: 12/10/2013 11:17 AM > Subject: Re: TThreadedServer link error > Sent by: [email protected] > > thanks for your answer ... > > can you say something more on the second method? > > > > On 10 December 2013 18:02, Ben Craig <[email protected]> wrote: > > > Currently, Thrift does not have a way to initiate a messages from the > > server side. There are two major ways to fake it though. > > > > 1. Have a method on your client interface to poll for events. Have this > > method's implementation on the server block until a new event arrives, > > then return the relevant information. > > 2. Create a second connection, going in the opposite direction. > > > > [email protected] wrote on 12/10/2013 10:56:39 AM: > > > > > From: Onorato Vaticone <[email protected]> > > > To: [email protected], > > > Date: 12/10/2013 10:57 AM > > > Subject: Re: TThreadedServer link error > > > Sent by: [email protected] > > > > > > just noted that the TimerManager mechanism could fit my needs .... > > > I can on the server side schedule a timer, and that's fine ... but how > > to > > > notify the client(s) about the event? might I use the callback? > > > > > > any idea? > > > > > > > > > > > > On 10 December 2013 17:31, Onorato Vaticone > > <[email protected]>wrote: > > > > > > > Hi guys, > > > > does thrift has event mechanism? > > > > would be nice to have the client callback (like in the > > TNonblockingServer) > > > > called from the server any time an "event" occurs on the server ... is > > > > something available of do I have to emulate it? > > > > > > > > TIA > > > > > > > -- > Onorato Vaticone > m : +39.3336048864 > email : [email protected] > web : www.onoratovaticone.it
