This gist contains the complete example service referenced in the article announcing nameko-grpc.
Use the following steps to demonstrate a running service:
-
Install requirements:
pip install -r requirements.txt
Note that this service also assumes you have a RabbitMQ broker running on
localhost:5672
. -
Generate code from the protocol buffer definitions:
python -m grpc_tools.protoc --proto_path . --python_out . --grpc_python_out . helloworld.proto
Or simply
make codegen
. -
Run the service:
nameko run service --config config.yaml
-
In another terminal, use the example client to call the service:
python greeter_client.py ${NAME}
As well as replying to the client, the server will save a new Greeting
entry into the SQLite database greetings.db
. It will also have dispatched a Nameko Event to the RabbitMQ broker.