Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The grpc consumer side is too cumbersome to use #315

Open
thousmile opened this issue Oct 12, 2022 · 1 comment
Open

The grpc consumer side is too cumbersome to use #315

thousmile opened this issue Oct 12, 2022 · 1 comment
Labels
enhancement Auto-generates notes

Comments

@thousmile
Copy link

Consumer side, it's too troublesome to use:

@EnableEurekaClient
@component
public class GreeterServiceConsumer {
@Autowired
private EurekaClient client;

public void greet(String name) {
    final InstanceInfo instanceInfo = client.getNextServerFromEureka("my-service-name", false);//(1)
    final ManagedChannel channel = ManagedChannelBuilder.forAddress(instanceInfo.getIPAddr(), instanceInfo.getPort())
            .usePlaintext()
            .build(); //(2)
    final GreeterServiceGrpc.GreeterServiceFutureStub stub = GreeterServiceGrpc.newFutureStub(channel); //(3)
    stub.greet(name); //(4)
}

}

such as:

@EnableEurekaClient
@component
public class GreeterServiceConsumer {

@GrpcClient("gRPC server name")
private GreeterServiceGrpc.GreeterBlockingStub stub; //(1)

public void greet(String name) {
    stub.greet(name); //(2)
}

}

@jvmlet jvmlet added the enhancement Auto-generates notes label Oct 16, 2022
@omutas
Copy link

omutas commented Jun 6, 2023

@jvmlet Is there any update about this enhancement?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Auto-generates notes
Projects
None yet
Development

No branches or pull requests

3 participants