moehajj edited a comment on issue #2205:
URL: https://github.com/apache/camel-k/issues/2205#issuecomment-817895840
Hi Team, I'm working alongside @viacheslav-fomin-main. I would like to
provide some context for this issue to help you reproduce if needed.
## The Proto File
Our `.proto` file looks something like this (we package it in
`com.example:example-proto:1.0.0-SNAPSHOT`):
```
syntax = "proto3";
package com.example;
option java_package = "com.example";
option java_multiple_files = true;
message ExampleRequest {
string request_message = 1;
int32 request_id = 2;
}
message ExampleResponse {
string response_message = 1;
int32 response_id = 2;
}
service ExampleService {
rpc Run(ExampleRequest) returns (ExampleResponse);
}
}
```
## The Java Route
Our `SampleGrpcCamelRoute.java` route looks like this:
```
package com.example.service.grpc;
import com.google.protobuf.ByteString;
import com.example.ExampleRequest;
import com.example.ExampleResponse;
import org.apache.camel.Message;
import org.apache.camel.builder.RouteBuilder;
import java.nio.charset.StandardCharsets;
public class SampleGrpcCamelRoute extends RouteBuilder {
@Override
public void configure() throws Exception {
fromF("grpc://localhost:9000/com.example.ExampleService?synchronous=true")
.process(exchange -> {
final Message message = exchange.getMessage();
final ExampleRequest request =
message.getBody(ExampleRequest.class);
final String output = "Hello World!";
final ExampleResponse response =
ExampleResponse.newBuilder()
.setMessage(output)
.build();
message.setBody(response);
});
}
}
```
We have verified this route works locally using java unit tests and Apache
Camel ContextTestSupport `org.apache.camel.ContextTestSupport`.
## Running using `kamel` CLI
We run the integration using the following command:
```
kamel run --dev \
-d mvn:com.example:example-proto:1.0.0-SNAPSHOT \
-d mvn:org.apache.camel:camel-grpc:3.9.0 \
-d mvn:org.apache.camel:camel-componentdsl:3.9.0 \
SampleGrpcCamelRoute.java
```
Using `kubectl port-forward` on the integration pod we are able to verify
the grpc route is working using the same tests we had run locally.
We tried a plethora of camel-k `trait`s including:
```
--trait container.service-port=9000 \
--trait container.expose=true \
--trait knative.enabled=true \
--trait knative-service.enabled=true \
--trait
knative-service.autoscaling-class=kpa.autoscaling.knative.dev \
--trait knative-service.min-scale=1 \
--trait knative-service.max-scale=1 \
```
Thank you for the support!
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]