diff options
author | Davanum Srinivas <davanum@gmail.com> | 2016-02-18 22:01:47 -0500 |
---|---|---|
committer | Davanum Srinivas <davanum@gmail.com> | 2016-02-22 16:07:30 -0800 |
commit | 11f78de5f08ccd86d944a9678c4d3096860a1aa3 (patch) | |
tree | f63011cc3091594028e2e8b5538fbb5faa2fe1e7 /tools/simulator.py | |
parent | 92c4f76c797f121bec11e53e7895909807d9ba1d (diff) | |
download | oslo-messaging-11f78de5f08ccd86d944a9678c4d3096860a1aa3.tar.gz |
Avoid hardcoding the notification topic and specify driver
"n-t1" as notification topic not really useful. Let's allow
it to be specified from the command line. Also make sure
we set the notification driver as "messaging" by default
Change-Id: I5daf09b9a01e4d642b0f53d7634d5b305d5a82cb
Diffstat (limited to 'tools/simulator.py')
-rwxr-xr-x | tools/simulator.py | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/tools/simulator.py b/tools/simulator.py index 4d75a44..1551955 100755 --- a/tools/simulator.py +++ b/tools/simulator.py @@ -121,9 +121,9 @@ class NotifyEndpoint(Monitor): return messaging.NotificationResult.HANDLED -def notify_server(transport, show_stats): +def notify_server(transport, topic, show_stats): endpoints = [NotifyEndpoint(show_stats)] - target = messaging.Target(topic='n-t1') + target = messaging.Target(topic=topic) server = notify.get_notification_listener(transport, [target], endpoints, executor='eventlet') server.start() @@ -152,9 +152,9 @@ class BatchNotifyEndpoint(Monitor): return messaging.NotificationResult.HANDLED -def batch_notify_server(transport, show_stats): +def batch_notify_server(transport, topic, show_stats): endpoints = [BatchNotifyEndpoint(show_stats)] - target = messaging.Target(topic='n-t1') + target = messaging.Target(topic=topic) server = notify.get_batch_notification_listener( transport, [target], endpoints, executor='eventlet', @@ -298,8 +298,10 @@ def _rpc_cast(client, msg): LOG.debug("SENT: %s", msg) -def notifier(_id, transport, messages, wait_after_msg, timeout): - n1 = notify.Notifier(transport, topic="n-t1").prepare( +def notifier(_id, topic, transport, messages, wait_after_msg, timeout): + n1 = notify.Notifier(transport, + driver='messaging', + topic=topic).prepare( publisher_id='publisher-%d' % _id) msg = 0 for i in range(0, messages): @@ -418,12 +420,12 @@ def main(): rpc_server(transport, target, args.wait_before_answer, args.executor, args.show_stats, args.duration) elif args.mode == 'notify-server': - notify_server(transport, args.show_stats) + notify_server(transport, args.topic, args.show_stats) elif args.mode == 'batch-notify-server': - batch_notify_server(transport, args.show_stats) + batch_notify_server(transport, args.topic, args.show_stats) elif args.mode == 'notify-client': - threads_spawner(args.threads, notifier, transport, args.messages, - args.wait_after_msg, args.timeout) + threads_spawner(args.threads, notifier, args.topic, transport, + args.messages, args.wait_after_msg, args.timeout) elif args.mode == 'rpc-client': init_msg(args.messages) targets = [target.partition('.')[::2] for target in args.targets] |