///////////////////////////////////////////////////////////////////////////////

    Copyright (c) 2019, 2020 Oracle and/or its affiliates.

    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
    You may obtain a copy of the License at

        http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.

///////////////////////////////////////////////////////////////////////////////

:javadoc-base-url-api: {javadoc-base-url}io.helidon.grpc.client/io/helidon/grpc/client
:pagename: grpc-client-configuration
:description: Helidon gRPC Client Configuration
:keywords: helidon, grpc, java, configuration

= gRPC Client Configuration

Configure the gRPC client using the Helidon configuration framework, either programmatically or via a configuration file.

As mentioned earlier, creating a `GrpcServiceClient` involves:

1. Creating a `ClientServiceDescriptor` which describes the methods in the service that this client can invoke.
2. Creating a gRPC `Channel` through which the client communicates with the server.

== Configuring the ClientServiceDescriptor

=== Configuring the ClientServiceDescriptor in your code

The only way to configure the `ClientServiceDescriptor` is in your application code.

[source,java]
----
ClientServiceDescriptor descriptor = ClientServiceDescriptor +
        .builder(HelloService.class)    // (1)
        .unary("SayHello")              // (2)
        .build();                       // (3)
----

1. Create a  builder for a `ClientServiceDescriptor` for the `HelloService`.
2. Specify that the `HelloService` has a unary method named `SayHello`. There are many other methods in this class that allow you
to define `ClientStreaming`, `ServerStreaming` and `Bidirectional` methods.
3. Build the `ClientServiceDescriptor`.

== Configuring the gRPC Channel

gRPC allows various channel configurations (deadlines, retries, interceptors etc.)

Please refer to gRPC documentation: https://grpc.io/grpc-java/javadoc/io/grpc/ManagedChannelBuilder.html.



