use of org.apache.beam.vendor.grpc.v1p43p2.io.grpc.Channel in project dble by actiontech.
the class UcoreClearKeyListener method init.
public void init() {
Channel channel = ManagedChannelBuilder.forAddress(UcoreConfig.getInstance().getValue(ClusterParamCfg.CLUSTER_PLUGINS_IP), Integer.parseInt(UcoreConfig.getInstance().getValue(ClusterParamCfg.CLUSTER_PLUGINS_PORT))).usePlaintext(true).build();
stub = UcoreGrpc.newBlockingStub(channel);
}
use of org.apache.beam.vendor.grpc.v1p43p2.io.grpc.Channel in project incubator-skywalking by apache.
the class AbstractStubInterceptor method onConstruct.
@Override
public void onConstruct(EnhancedInstance objInst, Object[] allArguments) {
Channel channel = (Channel) allArguments[0];
objInst.setSkyWalkingDynamicField(ClientInterceptors.intercept(channel, new GRPCClientInterceptor()));
}
use of org.apache.beam.vendor.grpc.v1p43p2.io.grpc.Channel in project sharding-jdbc by shardingjdbc.
the class EtcdChannelFactory method getInstance.
/**
* Get etcd channel instance.
*
* @param endpoints etcd endpoints
* @return etcd channel
*/
public static Channel getInstance(final List<String> endpoints) {
if (etcdChannels.containsKey(endpoints)) {
return etcdChannels.get(endpoints);
}
Channel channel = NettyChannelBuilder.forTarget(TARGET).usePlaintext(true).nameResolverFactory(new EtcdNameSolverFactory(TARGET, endpoints)).loadBalancerFactory(RoundRobinLoadBalancerFactory.getInstance()).build();
Channel result = etcdChannels.putIfAbsent(endpoints, channel);
return null == result ? channel : result;
}
use of org.apache.beam.vendor.grpc.v1p43p2.io.grpc.Channel in project pinpoint by naver.
the class ManagedChannelUtilsTest method testGetLogId.
@Test
public void testGetLogId() {
Channel channel = mock(Channel.class);
when(channel.toString()).thenReturn("ManagedChannelOrphanWrapper{delegate=ManagedChannelImpl{logId=1, target=127.0.0.1:9993}}");
Assert.assertEquals(1, ManagedChannelUtils.getLogId(channel));
}
use of org.apache.beam.vendor.grpc.v1p43p2.io.grpc.Channel in project beam by apache.
the class ServerFactoryTest method runTestUsing.
private Endpoints.ApiServiceDescriptor runTestUsing(ServerFactory serverFactory, ManagedChannelFactory channelFactory) throws Exception {
Endpoints.ApiServiceDescriptor.Builder apiServiceDescriptorBuilder = Endpoints.ApiServiceDescriptor.newBuilder();
final Collection<Elements> serverElements = new ArrayList<>();
final CountDownLatch clientHangedUp = new CountDownLatch(1);
CallStreamObserver<Elements> serverInboundObserver = TestStreams.withOnNext(serverElements::add).withOnCompleted(clientHangedUp::countDown).build();
TestDataService service = new TestDataService(serverInboundObserver);
Server server = serverFactory.allocateAddressAndCreate(ImmutableList.of(service), apiServiceDescriptorBuilder);
assertFalse(server.isShutdown());
ManagedChannel channel = channelFactory.forDescriptor(apiServiceDescriptorBuilder.build());
BeamFnDataGrpc.BeamFnDataStub stub = BeamFnDataGrpc.newStub(channel);
final Collection<BeamFnApi.Elements> clientElements = new ArrayList<>();
final CountDownLatch serverHangedUp = new CountDownLatch(1);
CallStreamObserver<BeamFnApi.Elements> clientInboundObserver = TestStreams.withOnNext(clientElements::add).withOnCompleted(serverHangedUp::countDown).build();
StreamObserver<Elements> clientOutboundObserver = stub.data(clientInboundObserver);
StreamObserver<BeamFnApi.Elements> serverOutboundObserver = service.outboundObservers.take();
clientOutboundObserver.onNext(CLIENT_DATA);
serverOutboundObserver.onNext(SERVER_DATA);
clientOutboundObserver.onCompleted();
clientHangedUp.await();
serverOutboundObserver.onCompleted();
serverHangedUp.await();
assertThat(clientElements, contains(SERVER_DATA));
assertThat(serverElements, contains(CLIENT_DATA));
return apiServiceDescriptorBuilder.build();
}
Aggregations