All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.twitter.finagle.example.java.thrift.ThriftClient Maven / Gradle / Ivy

The newest version!
package com.twitter.finagle.example.java.thrift;

import com.twitter.finagle.Thrift;
import com.twitter.finagle.example.thriftscala.Hello;
import com.twitter.util.Await;
import com.twitter.util.Function;
import com.twitter.util.Future;
import java.lang.Exception;
import scala.runtime.BoxedUnit;

public class ThriftClient {
  public static void main(String args[]) throws Exception {
    //#thriftclientapi
    Hello.FutureIface client = Thrift.newIface("localhost:8080", Hello.FutureIface.class);
    Future response = client.hi().onSuccess(new Function() {
      @Override
      public BoxedUnit apply(String response) {
        System.out.println("Received response: " + response);
        return null;
      }
    });

    Await.result(response);
    //#thriftclientapi
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy