The following example shows how to use asyncapi-python
package to create remote procedure call communications.
-
A working
amqp
brokerThis example assumes that it will be accessible by
amqp://guest:guest@localhost
. If this is not true, setAMQP_URI
envvar accordingly
-
cd
into this directory -
Create python virtual environment and activate it.
Alternatively, run
make venv install
.python3 -m venv .venv . .venv/bin/activate
-
Generate client and server modules.
Alternatively, run
make generate
.asyncapi-python-codegen spec/client.asyncapi.yaml client --force asyncapi-python-codegen spec/server.asyncapi.yaml server --force
-
Run server and client code simultaneously. This requires two terminals.
.venv/bin/python main-server.py
.venv/bin/python main-client.py