1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115
|
============================
Oslo Messaging Simulator
============================
This guide explains how to set up and run the oslo messaging simulator for testing
different messaging scenarios.
Prerequisites
-------------
* Python 3.x
* virtualenv
* wget (for Kafka scenarios)
Environment Setup
-----------------
This assumes you have git cloned the oslo.messaging repository and are in the root
directory of the repository.
Create and activate a virtual environment::
python -m venv .venv
source .venv/bin/activate
Install required packages::
pip install pifpaf
pip install -e .
Running the Simulator
---------------------
The simulator supports different scenarios for testing messaging patterns. Below
are the common usage patterns.
Basic Setup
^^^^^^^^^^^
Before running the simulator, set up the messaging environment::
./tools/setup-scenario-env.sh
Available Scenarios
^^^^^^^^^^^^^^^^^^^
The simulator supports two main scenarios:
Scenario 01 (RabbitMQ only)
***************************
This scenario uses RabbitMQ for both RPC and notifications::
export SCENARIO=scenario01
./tools/setup-scenario-env.sh
Scenario 02 (RabbitMQ + Kafka)
******************************
This scenario uses RabbitMQ for RPC and Kafka for notifications::
export SCENARIO=scenario02
./tools/setup-scenario-env.sh
Running the Simulator
^^^^^^^^^^^^^^^^^^^^^
RPC Server Example
******************
To start the RPC server::
python tools/simulator.py --url rabbit://pifpaf:secret@127.0.0.1:5682/ rpc-server
RPC Client Example
******************
To start the RPC client::
python tools/simulator.py --url rabbit://pifpaf:secret@127.0.0.1:5682/ rpc-client --exit-wait 15000 -p 64 -m 64
Optional Configuration
----------------------
You can generate a sample configuration file using oslo-config-generator::
oslo-config-generator --namespace oslo.messaging > oslo.messaging.conf
For reference on all available configuration options, visit:
https://docs.openstack.org/oslo.messaging/latest/configuration/opts.html
To use a configuration file with the simulator, use the --config-file option::
python tools/simulator.py --config-file oslo.messaging.conf [other options]
Command Line Options
--------------------
The simulator supports various command line options:
--url URL
The transport URL for the messaging service
--config-file PATH
Path to a configuration file
-d, --debug
Enable debug mode
-p PROCESSES
Number of processes (for client)
-m MESSAGES
Number of messages (for client)
--exit-wait MILLISECONDS
Wait time before exit (for client)
Cleanup
-------
To clean up the environment, you can terminate the running processes::
pkill -f "RABBITMQ"
Notes
-----
* The default scenario is scenario01 if not specified
* Kafka setup is automatic when using scenario02
* The simulator uses pifpaf to manage the message broker processes
* Installing with ``pip install -e .`` allows for development mode installation
* Configuration options can be referenced in the official documentation
|