#!/usr/bin/env python
#
import optparse, sys, time

from oslo.config import cfg
from oslo import messaging

class TestEndpoint01(object):
    def __init__(self, server, target=None):
        self.server = server
        self.target = target

    def methodA(self, ctx, **args):
        print("%s::TestEndpoint01::methodA( ctxt=%s arg=%s ) called!!!"
              % (self.server, str(ctx),str(args)))
    def common(self, ctx, **args):
        print("%s::TestEndpoint01::common( ctxt=%s arg=%s ) called!!!"
              % (self.server, str(ctx),str(args)))

class TestEndpoint02(object):
    def __init__(self, server, target=None):
        self.server = server
        self.target = target

    def methodB(self, ctx, **args):
        print("%s::TestEndpoint02::methodB( ctxt=%s arg=%s ) called!!!"
              % (self.server, str(ctx),str(args)))
        return ctx
    def common(self, ctx, **args):
        print("%s::TestEndpoint02::common( ctxt=%s arg=%s ) called!!!"
              % (self.server, str(ctx),str(args)))


def main(argv=None):

    _usage = """Usage: %prog [options]"""
    parser = optparse.OptionParser(usage=_usage)
    parser.add_option("--exchange", action="store", default="my-exchange")
    parser.add_option("--topic", action="store", default="my-topic")
    parser.add_option("--server", action="store", default="my-server-name")
    parser.add_option("--namespace", action="store", default="my-namespace")
    parser.add_option("--version", action="store", default="1.1")
    parser.add_option("--eventlet", action="store_true")

    opts, extra = parser.parse_args(args=argv)
    print "Running server, name=%s exchange=%s topic=%s namespace=%s" % (
        opts.server, opts.exchange, opts.topic, opts.namespace)

    transport = messaging.get_transport(cfg.CONF, url="qpid://localhost:5672")

    target = messaging.Target(exchange=opts.exchange,
                              topic=opts.topic,
                              namespace=opts.namespace,
                              server=opts.server,
                              version=opts.version)

    endpoints = [
        TestEndpoint01(opts.server, target),
        TestEndpoint02(opts.server, target),
        ]
    server = messaging.get_rpc_server(transport, target, endpoints,
                                      executor='eventlet' if opts.eventlet else 'blocking')

    try:
        server.start()
        while True:
            time.sleep(1)
            sys.stdout.write('.')
            sys.stdout.flush()
    except KeyboardInterrupt:
        print("Stopping..")
        server.stop()
        server.wait()
    return 0

if __name__ == "__main__":
    sys.exit(main())

@@ -1087,12 +1087,19 @@
 ons%5D
+ %3Cname%3E
 %22%22%22%0A
-
     
@@ -1287,24 +1287,25 @@
 topic%22)%0A    
+#
 parser.add_o
@@ -1612,16 +1612,117 @@
 s=argv)%0A
+    if not extra:%0A        print %22%3Cname%3E not supplied!%22%0A        return -1%0A    server_name = extra%5B0%5D%0A%0A
     prin
@@ -1795,27 +1795,27 @@
         
-opts.
 server
+_name
 , opts.e
@@ -2127,27 +2127,27 @@
  server=
-opts.
 server
+_name
 ,%0A      
@@ -2234,27 +2234,27 @@
 point01(
-opts.
 server
+_name
 , target
@@ -2283,19 +2283,19 @@
 t02(
-opts.
 server
+_name
 , ta

enforce use of server name