use of org.apache.pulsar.functions.proto.InstanceControlGrpc.InstanceControlFutureStub in project incubator-pulsar by apache.
the class ProcessRuntime method main.
public static void main(String[] args) throws ExecutionException, InterruptedException {
int port = Integer.parseInt(args[0]);
ManagedChannel channel = ManagedChannelBuilder.forAddress("127.0.0.1", port).usePlaintext(true).build();
InstanceControlFutureStub stub = InstanceControlGrpc.newFutureStub(channel);
ListenableFuture<FunctionStatus> response = stub.getFunctionStatus(Empty.newBuilder().build());
CompletableFuture<FunctionStatus> future = new CompletableFuture<>();
Futures.addCallback(response, new FutureCallback<FunctionStatus>() {
@Override
public void onFailure(Throwable throwable) {
log.info("GetFunctionStatus:", throwable);
future.completeExceptionally(throwable);
}
@Override
public void onSuccess(InstanceCommunication.FunctionStatus t) {
log.info("GetFunctionStatus: {}", t);
future.complete(t);
}
});
FunctionStatus status = future.get();
log.info("Function Status : {}", status);
}
Aggregations