-
Notifications
You must be signed in to change notification settings - Fork 526
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
Can you show how to invoke gRPC service with http invoke? #695
Comments
I'm currently stuck on this as well. |
@safari137 got it working by implementing the UnimplementedAppCallbackServer which defines an OnInvoke method. This is described in the integrations example here: https://docs.dapr.io/developing-applications/integrations/grpc-integration/. This allows a call into your service via HTTP. The onInvoke method should check the 'in.Method' property and pass the request to your service handler. My current understanding after this early bit of experimentation with implementing a dapr gRPC service:
I'm going to work on a more elaborate sample service to test this out including pub/sub and http middleware. It would be nice if the documentation would explain this a bit better or if there is example code that does this. Hope this helps. |
@hspaay thanks for the explanation! This is very helpful. |
In case anyone else wonders how to do this. This simple echo service demonstrates grpc->grpc and http->grpc invocation. |
Thank you much for the contribution @hspaay. The recommendation we have for Invoke is to use I believe you nail this here: https://github.com/wostzone/echo-dapr/blob/main/pkg/plain-grpc/client/main.go#L70 Note we have docs and how-to's for this approach here: |
@paulyuk - how would you like to resolve this issue? |
gRPC proxying is for gRPC to gRPC communication. The detailed reply by @hspaay above covers how you would achieve HTTP to gRPC, however since then we have deprecated the OnInvoke method and HTTP to gRPC isn't a recommended scenario, so shouldn't be in either docs nor quickstarts. |
Ok thank you for clarifying. We will not doc or have samples for things we do not support. Thank you both. |
these docs are still in latest version from docs. as of docs v1.14 |
Ask your question here
Following the helpful go quickstart service_invocation works like a charm. When I'm converting it to use gRPC with protobuf that works as well.
However, invoking the gRPC using the dapr http API doesn't work and results into 503 Service Unavailable.
Would it be possible to include this cross-protocol as an example in the quickstart?
Update: link to issue that suggests this should work: dapr/dapr#2342
Although what is not clear if this requires the gRPC service to implement an onInvoke method as per (dapr/java-sdk#535)
The text was updated successfully, but these errors were encountered: