use of org.apache.camel.component.grpc.server.GrpcMethodHandler in project camel-quarkus by apache.
the class QuarkusBindableServiceFactory method createBindableService.
@Override
public BindableService createBindableService(GrpcConsumer consumer) {
GrpcEndpoint endpoint = (GrpcEndpoint) consumer.getEndpoint();
CamelContext camelContext = endpoint.getCamelContext();
Class<?> baseClass = GrpcUtils.constructGrpcImplBaseClass(endpoint.getServicePackage(), endpoint.getServiceName(), camelContext);
// Find the BindableService implementation that was generated in GrpcProcessor and configure the GrpcMethodHandler
CamelQuarkusBindableService bindableService = bindableServices.stream().filter(service -> baseClass.isAssignableFrom(service.getClass())).findFirst().orElseThrow(() -> new IllegalStateException("Unable to find generated class for service " + endpoint.getServiceName()));
GrpcMethodHandler methodHandler = new GrpcMethodHandler(consumer);
bindableService.setMethodHandler(methodHandler);
return bindableService;
}
Aggregations