Search in sources :

Example 26 with ManagedChannel

use of org.apache.beam.vendor.grpc.v1p43p2.io.grpc.ManagedChannel in project zipkin-gcp by openzipkin.

the class StackdriverSender method newBuilder.

public static Builder newBuilder() {
    ManagedChannel channel = ManagedChannelBuilder.forTarget("cloudtrace.googleapis.com").build();
    Builder result = newBuilder(channel);
    result.shutdownChannelOnClose = true;
    return result;
}
Also used : ManagedChannelBuilder(io.grpc.ManagedChannelBuilder) ManagedChannel(io.grpc.ManagedChannel)

Example 27 with ManagedChannel

use of org.apache.beam.vendor.grpc.v1p43p2.io.grpc.ManagedChannel in project sample-googleassistant by androidthings.

the class EmbeddedAssistant method connect.

/**
 * Initializes the Assistant.
 */
public void connect() {
    mAssistantThread = new HandlerThread("assistantThread");
    mAssistantThread.start();
    mAssistantHandler = new Handler(mAssistantThread.getLooper());
    ManagedChannel channel = ManagedChannelBuilder.forTarget(ASSISTANT_API_ENDPOINT).build();
    mAssistantService = EmbeddedAssistantGrpc.newStub(channel).withCallCredentials(MoreCallCredentials.from(mUserCredentials));
}
Also used : HandlerThread(android.os.HandlerThread) Handler(android.os.Handler) ManagedChannel(io.grpc.ManagedChannel)

Example 28 with ManagedChannel

use of org.apache.beam.vendor.grpc.v1p43p2.io.grpc.ManagedChannel in project seldon-core by SeldonIO.

the class SeldonGrpcServer method deploymentAdded.

public void deploymentAdded(SeldonDeployment resource) {
    ManagedChannel channel = ManagedChannelBuilder.forAddress(resource.getSpec().getName(), appProperties.getEngineGrpcContainerPort()).usePlaintext(true).build();
    channelStore.put(resource.getSpec().getOauthKey(), channel);
}
Also used : ManagedChannel(io.grpc.ManagedChannel)

Example 29 with ManagedChannel

use of org.apache.beam.vendor.grpc.v1p43p2.io.grpc.ManagedChannel in project seldon-core by SeldonIO.

the class SeldonGrpcServer method getChannel.

/**
 * Using the principal from authorization return a client gRPC channel to connect to the engine running the prediction graph.
 * @return ManagedChannel
 */
public ManagedChannel getChannel() {
    final String principal = getPrincipal();
    if (principal == null) {
        throw new SeldonAPIException(SeldonAPIException.ApiExceptionType.APIFE_GRPC_NO_PRINCIPAL_FOUND, "");
    }
    final DeploymentSpec deploymentSpec = deploymentStore.getDeployment(principal);
    if (deploymentSpec == null) {
        throw new SeldonAPIException(SeldonAPIException.ApiExceptionType.APIFE_NO_RUNNING_DEPLOYMENT, "Principal is " + principal);
    }
    ManagedChannel channel = channelStore.get(principal);
    if (channel == null) {
        throw new SeldonAPIException(SeldonAPIException.ApiExceptionType.APIFE_GRPC_NO_GRPC_CHANNEL_FOUND, "Principal is " + principal);
    }
    return channel;
}
Also used : SeldonAPIException(io.seldon.apife.exception.SeldonAPIException) DeploymentSpec(io.seldon.protos.DeploymentProtos.DeploymentSpec) ManagedChannel(io.grpc.ManagedChannel)

Example 30 with ManagedChannel

use of org.apache.beam.vendor.grpc.v1p43p2.io.grpc.ManagedChannel in project flink by apache.

the class DefaultPubSubSubscriberFactory method getSubscriber.

@Override
public PubSubSubscriber getSubscriber(Credentials credentials) throws IOException {
    ManagedChannel channel = NettyChannelBuilder.forTarget(SubscriberStubSettings.getDefaultEndpoint()).negotiationType(NegotiationType.TLS).sslContext(GrpcSslContexts.forClient().ciphers(null).build()).build();
    PullRequest pullRequest = PullRequest.newBuilder().setMaxMessages(maxMessagesPerPull).setSubscription(projectSubscriptionName).build();
    SubscriberGrpc.SubscriberBlockingStub stub = SubscriberGrpc.newBlockingStub(channel).withCallCredentials(MoreCallCredentials.from(credentials));
    return new BlockingGrpcPubSubSubscriber(projectSubscriptionName, channel, stub, pullRequest, retries, timeout);
}
Also used : PullRequest(com.google.pubsub.v1.PullRequest) ManagedChannel(io.grpc.ManagedChannel) SubscriberGrpc(com.google.pubsub.v1.SubscriberGrpc)

Aggregations

ManagedChannel (io.grpc.ManagedChannel)163 Test (org.junit.Test)92 CountDownLatch (java.util.concurrent.CountDownLatch)26 ManagedChannel (org.apache.beam.vendor.grpc.v1p43p2.io.grpc.ManagedChannel)26 ArrayList (java.util.ArrayList)20 Metadata (io.grpc.Metadata)18 EquivalentAddressGroup (io.grpc.EquivalentAddressGroup)15 ExecutorService (java.util.concurrent.ExecutorService)13 ByteString (com.google.protobuf.ByteString)12 Status (io.grpc.Status)12 StreamObserver (org.apache.beam.vendor.grpc.v1p43p2.io.grpc.stub.StreamObserver)11 StreamObserver (io.grpc.stub.StreamObserver)10 ConcurrentLinkedQueue (java.util.concurrent.ConcurrentLinkedQueue)10 AtomicReference (java.util.concurrent.atomic.AtomicReference)10 BeamFnApi (org.apache.beam.model.fnexecution.v1.BeamFnApi)10 CallOptions (io.grpc.CallOptions)9 Subchannel (io.grpc.LoadBalancer.Subchannel)9 SubchannelPicker (io.grpc.LoadBalancer.SubchannelPicker)9 LinkedBlockingQueue (java.util.concurrent.LinkedBlockingQueue)9 Endpoints (org.apache.beam.model.pipeline.v1.Endpoints)9