Test RPC client and server using the oslo.messaging API
A set of simple oslo.messaging clients. You can use these clients to
play with the oslo.messaging API.
rpc-server - Listens for RPC requests and sends replies.
rpc-client - Sends RPC requests to an RPC server.
listener - Listens for notification messages.
notifier - Sends notification messages.
Use the --help option for more detail.
For more info on Openstack and oslo.messaging, see:
Not officially part of the olso.messaging project, just my own sandbox
to play in.
These examples assume your are running the RabbitMQ broker on
localhost port 5672. You can use the --url parameter to specify a
different address if necessary (e.g. --url rabbit://some.host.com:9999
To run an RPC server (best to do this in its own dedicated terminal as
it blocks):
$ ./rpc-server --name Server01
Running server, name=Server01 exchange=my-exchange topic=my-topic namespace=my-namespace
Then use rpc-client to make an RPC call to the server:
$ ./rpc-client --method echo --kwargs “arg1=value1 arg2=value2”
Calling server on topic my-topic, server=None exchange=my-exchange namespace=my-namespace fanout=None
See the source for the server (rpc-server) for the RPC methods it supports.
A similar example, but for notifications:
First run a notification listener, for example assuming RabbitMQ on localhost:
$ ./listener --url rabbit://localhost:5672 &
Now you can issue notifications using the notifier command:
$ ./notifier
By default notifier issues a Debug level notification. You can change
this using the --severity parameter:
You can set the oslo.messaging configuration values by passing the
clients a configuration file. Use the --oslo-config
Example: to configure the rpc-server with values from ./configs/rpc-server.conf:
./rpc-server.py --oslo-config ./configs/rpc-server.conf --name MyServer
These clients can be run using the proposed AMQP 1.0 driver
for olso.messaging. See: https://review.openstack.org/#/c/75815
This driver will work with the latest Qpid broker (qpidd), as well as
the Qpid Dispatch Router. See:
http://qpid.apache.org/components/dispatch-router/index.html for more
details regarding the Dispatch Router.
More detail TBD, but in summary you’ll need to:
If you’ve installed the Proton stuff in a non-standard path, you
must set your python path so the clients can find the Proton Messenger
python modules and C library wrapper. For example:
$ export PYTHONPATH=“$PYTHONPATH:/home/kgiusti/proton/0.7/INSTALL/usr/lib64/python2.7/site-packages”
If using Qpid:
qpidd --queue-patterns exclusive --queue-patterns unicast --topic-patterns broadcast
Note that Qpidd must be built with AMQP 1.0 support enabled! For
example, if building against a non-standard install of Proton:
cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo
-DCMAKE_INSTALL_PREFIX=/home/kgiusti/work/proton/0.7/INSTALL
-DSYSINSTALL_BINDINGS=OFF …
else if using Dispatch Router:
2a) Build Dispatch Router, linking it against the Proton libraries you
installed in 0). For example, if building against a non-standard
install of Proton:
cmake -DCMAKE_INCLUDE_PATH=/home/kgiusti/work/proton/0.7/INSTALL/include
-DCMAKE_LIBRARY_PATH=/home/kgiusti/work/proton/0.7/INSTALL/lib64 …
export PYTHONPATH=“$PYTHONPATH:$(pwd)/python”
2b) Start the Dispatch Router, using the configuration provided in the
oslo.messaging.dispatch.conf file.
qdrouterd -c ./oslo.messaging.dispatch.conf
rpc-server --url amqp://<address of Dispatch/Qpidd> Server01
rpc-client --url amqp://<address of Dispatch/Qpidd> echo key value
You can source the env.sh
file to obtain some shortcuts.
Examples:
$ source env.sh
$ oslo_start_cluster # start a rabbitmq cluster
$ oslo_blackout_start # simulate a network issue