Grpc 与 Spring Camel Web 应用程序集成
我有一个基于 spring-camel 的网络服务。我正在尝试使用 grpc-spring-boot-starter 集成 grpc 服务器。我的 grpc 服务的实现如下。
@GrpcService
public class GreetingServiceImpl extends GreetingServiceGrpc.GreetingServiceImplBase {
@Override
public void processGrpcRequest(GreetingRequest request, StreamObserver<GreetingResponse> responseObserver) {
String receivedMessage = request.getRequest();
GreetingResponse response = GreetingResponse.newBuilder()
.setResponse("Your message received " + receivedMessage).build();
responseObserver.onNext(response);
responseObserver.onCompleted();
}
}
我将 Web 服务打包为 war,并且在应用程序服务器中部署 war 文件期间没有发现任何错误。但是,当我尝试与 grpc 服务器通信时,收到以下错误消息。
Exception in thread "main" 15:18:01.363 [grpc-nio-worker-ELG-1-2] DEBUG io.grpc.netty.shaded.io.grpc.netty.NettyClientHandler - [id: 0x02a01ffb, L:/127.0.0.1:56000 - R:localhost/127.0.0.1:9089] INBOUND PING: ack=true bytes=1234
io.grpc.StatusRuntimeException: UNIMPLEMENTED: HTTP status code 404
invalid content-type: text/html
headers: Metadata(:status=404,content-type=text/html,date=Fri, 04 Mar 2022 09:48:01 GMT,content-length=74)
DATA-----------------------------
<html><head><title>Error</title></head><body>404 - Not Found</body></html>
at io.grpc.stub.ClientCalls.toStatusRuntimeException(ClientCalls.java:262)
at io.grpc.stub.ClientCalls.getUnchecked(ClientCalls.java:243)
at io.grpc.stub.ClientCalls.blockingUnaryCall(ClientCalls.java:156)
at com.test.grpc.GreetingServiceGrpc$GreetingServiceBlockingStub.processGrpcRequest(GreetingServiceGrpc.java:156)
at com.test.grpc.GrpcClient.main(GrpcClient.java:16)
我用最少的设置重新创建了相同的问题,代码可在此处获取 github 。请任何人帮忙解决这个问题。谢谢
I have a web service built on spring-camel. I am trying to integrate the grpc server using grpc-spring-boot-starter. My implementation of grpc service is as below.
@GrpcService
public class GreetingServiceImpl extends GreetingServiceGrpc.GreetingServiceImplBase {
@Override
public void processGrpcRequest(GreetingRequest request, StreamObserver<GreetingResponse> responseObserver) {
String receivedMessage = request.getRequest();
GreetingResponse response = GreetingResponse.newBuilder()
.setResponse("Your message received " + receivedMessage).build();
responseObserver.onNext(response);
responseObserver.onCompleted();
}
}
I package my web service as a war and I find no error during deployement of the war file in my application server. However, when I try to communicate with my grpc server, I get the following error message.
Exception in thread "main" 15:18:01.363 [grpc-nio-worker-ELG-1-2] DEBUG io.grpc.netty.shaded.io.grpc.netty.NettyClientHandler - [id: 0x02a01ffb, L:/127.0.0.1:56000 - R:localhost/127.0.0.1:9089] INBOUND PING: ack=true bytes=1234
io.grpc.StatusRuntimeException: UNIMPLEMENTED: HTTP status code 404
invalid content-type: text/html
headers: Metadata(:status=404,content-type=text/html,date=Fri, 04 Mar 2022 09:48:01 GMT,content-length=74)
DATA-----------------------------
<html><head><title>Error</title></head><body>404 - Not Found</body></html>
at io.grpc.stub.ClientCalls.toStatusRuntimeException(ClientCalls.java:262)
at io.grpc.stub.ClientCalls.getUnchecked(ClientCalls.java:243)
at io.grpc.stub.ClientCalls.blockingUnaryCall(ClientCalls.java:156)
at com.test.grpc.GreetingServiceGrpc$GreetingServiceBlockingStub.processGrpcRequest(GreetingServiceGrpc.java:156)
at com.test.grpc.GrpcClient.main(GrpcClient.java:16)
I have recreated the same issue with minimal setup and code is available here github . Please can anyone help on this. Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论