This example utilizes a receiver and a caller for the OnInvoke / Invoke functionality. It will create a gRPC server and bind the OnInvoke method, which gets called after a client sends a direct method invocation.
Note: Make sure to use the latest proto bindings
pip3 install dapr dapr-ext-grpc
Run the following command in a terminal/command-prompt:
# 1. Start Receiver (expose gRPC server receiver on port 50051)
dapr run --app-id invoke-receiver --app-protocol grpc --app-port 50051 python3 invoke-receiver.py
In another terminal/command prompt run:
# 2. Start Caller
dapr run --app-id invoke-caller --app-protocol grpc --dapr-http-port 3500 python3 invoke-caller.py
dapr stop --app-id invoke-caller
dapr stop --app-id invoke-receiver
-
Build docker image
docker build -t [your registry]/invokesimple:latest .
-
Push docker image
docker push [your registry]/invokesimple:latest
-
Edit image name to
[your registry]/invokesimple:latest
in deploy/*.yaml -
Deploy applications
kubectl apply -f ./deploy/
-
See logs for the apps and sidecars
Logs for caller sidecar:
dapr logs -a invoke-caller -k
Logs for caller app:
kubectl logs -l app="invokecaller" -c invokecaller
Logs for receiver sidecar:
dapr logs -a invoke-receiver -k
Logs for receiver app:
kubectl logs -l app="invokereceiver" -c invokereceiver