Skip to content

elliswuuuuuuuu/oslo-messaging-clients

 
 

Repository files navigation

A simple RPC client and server, built around the oslo.messaging
library from Openstack.  An academic exercise simply to gain an
understanding of the oslo.messenger API!

For more info on Openstack and oslo.messaging, see:

  http://www.openstack.org/

Not officially part of the olso.messaging project, just my own sandbox
to play in.

RUNNING
-------

1) run a local instance of qpidd:
$ qpidd --load-module=./src/amqp.so --auth no --queue-patterns exclusive --queue-patterns unicast --topic-patterns broadcast

2) make sure your python environment has oslo.messaging available.  If
it does not, you can use the config.sh script to set up a virtual
environment:

$ source config.sh

You can then run the clients from within this environment.  Remember
to use the 'deactivate' command to exit the environment when done!

3) run a server (best to do this in its own dedicated terminal as it blocks):

$ ./my-server.py Server01
Running server, name=Server01 exchange=my-exchange topic=my-topic namespace=my-namespace

4) run the client, invoking "methodA" on topic "my-topic" with
arguments "arg1" and "arg2":

$ ./my-client.py my-topic methodA arg1 arg2
Calling server on topic my-topic, server=None exchange=my-exchange namespace=my-namespace fanout=None

See the source for the server (my-server.py) for the RPC methods it supports.

You can also pass oslo configuration values using the --config
argument to the client and server.  Example - to set the
amqp_idle_timeout to 10 seconds:

./my-client.py --config amqp_idle_timeout 10 my-topic methodA arg1 arg2

Using AMQP 1.0 and the Dispatch Router
--------------------------------------

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:

0) Build and install the Proton/C libraries, See:
http://qpid.apache.org/proton/index.html.  I've used the 0.7 release.

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"

1) Pull a copy of the AMQP 1.0 driver for oslo.messenger (see link
above).  Use tox as above to set up your python environment.

If using Qpid:

2) Start the Qpid broker with the addition of the following queue and
topic pattern specifiers:

 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

3) Start a server, using the 'amqp:' protocol URL:

 my-server.py --url amqp://<address of Dispatch/Qpidd> Server01

4) Run a client:

 my-client.py --url amqp://<address of Dispatch/Qpidd> my-topic echo key value




About

Test RPC client and server using the oslo.messaging API

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 93.6%
  • Shell 6.4%