in tchannel-example/src/main/java/com/uber/tchannel/thrift/KeyValueClient.java [64:84]
public static void setValue(SubChannel subChannel, String key, String value) throws Exception {
KeyValue.setValue_args setValue = new KeyValue.setValue_args(key, value);
TFuture<ThriftResponse<KeyValue.setValue_result>> future = subChannel
.send(
new ThriftRequest.Builder<KeyValue.setValue_args>("keyvalue-service", "KeyValue::setValue")
.setTimeout(1000)
.setBody(setValue)
.build(),
TChannelUtilities.getCurrentIp(),
8888
);
try (ThriftResponse<KeyValue.setValue_result> response = future.get()) {
if (response.isError()) {
System.out.println("setValue failed due to: " + response.getError().getMessage());
} else {
System.out.println("setValue succeeded");
}
}
}