io.vertx.up.uca.micro.ipc.client.UnitySpear Maven / Gradle / Ivy
package io.vertx.up.uca.micro.ipc.client;
import io.grpc.ManagedChannel;
import io.vertx.core.Future;
import io.vertx.core.Vertx;
import io.vertx.tp.ipc.eon.IpcRequest;
import io.vertx.tp.ipc.service.UnityServiceGrpc;
import io.vertx.up.commune.Envelop;
import io.vertx.up.atom.rpc.IpcData;
import io.vertx.up.uca.micro.ipc.DataEncap;
import io.vertx.tp.plugin.rpc.RpcRepdor;
import io.vertx.tp.plugin.rpc.RpcSslTool;
public class UnitySpear implements Spear {
@Override
public Future send(
final Vertx vertx,
final IpcData data) {
// Channel
final ManagedChannel channel = RpcSslTool.getChannel(vertx, data);
final UnityServiceGrpc.UnityServiceVertxStub stub
= UnityServiceGrpc.newVertxStub(channel);
// Request
final IpcRequest request = DataEncap.in(data);
// Call and return to future
final Future handler = Future.future();
stub.unityCall(request, response ->
// Reply
RpcRepdor.create(getClass()).reply(handler, response));
return handler;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy