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-grpcRun 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.pyIn another terminal/command prompt run:
# 2. Start Caller
dapr run --app-id invoke-caller --app-protocol grpc --dapr-http-port 3500 python3 invoke-caller.pydapr 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:latestin deploy/*.yaml -
Deploy applications
kubectl apply -f ./deploy/ -
See logs for the apps and sidecars
Logs for caller sidecar:
dapr logs -a invoke-caller -kLogs for caller app:
kubectl logs -l app="invokecaller" -c invokecallerLogs for receiver sidecar:
dapr logs -a invoke-receiver -kLogs for receiver app:
kubectl logs -l app="invokereceiver" -c invokereceiver