This example utilizes a publisher and a receiver for the InvokeBinding / OnBindingEvent / ListInputBindings functionality. It will create a gRPC server and bind the OnBindingEvent method, which gets called after a publisher sends a message to a kafka binding.
Note: Make sure to use the latest proto bindings
pip3 install dapr dapr-ext-grpc
Run the following commands in a terminal/command-prompt:
- Start the kafka containers using docker-compose
docker-compose -f ./docker-compose-single-kafka.yml up -d
- Start Receiver (expose gRPC server receiver on port 50051)
dapr run --app-id receiver --app-protocol grpc --app-port 50051 --components-path ./components python3 invoke-input-binding.py
- Start Publisher
In another terminal/command-prompt run:
dapr run --app-id publisher --app-protocol grpc --components-path ./components python3 invoke-output-binding.py
The dapr apps can be stopped by calling stop or terminating the process:
dapr stop --app-id publisher
dapr stop --app-id receiver
For kafka cleanup, run the following code:
docker-compose -f ./docker-compose-single-kafka.yml down