All Downloads are FREE. Search and download functionalities are using the official Maven repository.

templates.graphql.GRpcClientModule.template Maven / Gradle / Ivy

package @[email protected];

import com.google.inject.AbstractModule;
import io.grpc.ManagedChannel;
import io.grpc.ManagedChannelBuilder;
import @[email protected].@microservice_name@Grpc;

public class GRpcClientModule extends AbstractModule {

    private String grpcServiceAddress;

    public GRpcClientModule(String grpcServiceAddress) {
        this.grpcServiceAddress = grpcServiceAddress;
    }

    @Override
    protected void configure() {
        ManagedChannel channel = ManagedChannelBuilder.forTarget(grpcServiceAddress).usePlaintext().build();
        @microservice_name@Grpc.@microservice_name@FutureStub futureStub = @[email protected](channel);
        bind(@microservice_name@Grpc.@[email protected]).toInstance(futureStub);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy