コード例 #1
0
 def setUp(self):
     super(ConnectionConfigTestCase, self).setUp()
     self.user = "******"
     self.password = "******"
     self.credentials = config.Credentials(self.user, self.password)
     self.host = "host"
     self.config = config.ConnectionConfig(self.host, self.credentials)
コード例 #2
0
ファイル: test_driver.py プロジェクト: phantomii/tavrida
 def setUp(self):
     super(AMQPDriverTestCase, self).setUp()
     self.user = "******"
     self.password = "******"
     self.credentials = config.Credentials(self.user, self.password)
     self.host = "host"
     self.conf = config.ConnectionConfig(self.host, self.credentials)
     self.driver = driver.AMQPDriver(self.conf)
コード例 #3
0
def run_me():

    creds = config.Credentials("guest", "guest")
    conf = config.ConnectionConfig("localhost",
                                   credentials=creds,
                                   async_engine=True)

    srv = server.Server(conf,
                        queue_name="test_service",
                        exchange_name="test_exchange",
                        service_list=[HelloController, WorldController])
    srv.run()
コード例 #4
0
    def __init__(self, config_file=None, project_name=None):
        configfile.get_config(sys.argv[1:],
                              project_name=project_name,
                              config_file=config_file)
        conf = configfile.CONF
        credentials = config.Credentials(username=conf.connection.username,
                                         password=conf.connection.password)
        ssl_opts = None
        if conf.ssl:
            ssl_opts = {
                "keyfile": conf.ssl.keyfile,
                "certfile": conf.ssl.certfile,
                "server_side": False,
                "cert_reqs": conf.ssl.cert_reqs,
                "ssl_version": conf.ssl.ssl_version,
                "ca_certs": conf.ssl.ca_certs,
                "suppress_ragged_eofs": conf.ssl.suppress_ragged_eofs,
                "ciphers": conf.ssl.ciphers,
            }
        conn_conf = config.ConnectionConfig(
            host=conf.connection.host,
            credentials=credentials,
            port=conf.connection.port,
            virtual_host=conf.connection.virtual_host,
            channel_max=conf.connection.channel_max,
            frame_max=conf.connection.frame_max,
            heartbeat_interval=conf.connection.heartbeat_interval,
            ssl=conf.connection.ssl,
            ssl_options=ssl_opts,
            connection_attempts=conf.connection.connection_attempts,
            retry_delay=conf.connection.retry_delay,
            socket_timeout=conf.connection.socket_timeout,
            locale=conf.connection.locale,
            backpressure_detection=conf.connection.backpressure_detection,
            reconnect_attempts=conf.connection.reconnect_attempts,
            async_engine=conf.connection.async_engine)

        service_list = configfile.get_services_classes()
        service_mapping = configfile.get_service_name_class_mapping()
        for service in configfile.get_services():
            df = discovery.DiscoveryFactory(service["discovery"])
            disc = df.get_discovery_service(service["name"],
                                            service.get("subscriptions"))
            service_mapping[service["name"]].set_discovery(disc)

        super(CLIServer,
              self).__init__(conn_conf,
                             queue_name=conf.server.queue_name,
                             exchange_name=conf.server.exchange_name,
                             service_list=service_list)
コード例 #5
0
ファイル: world_server.py プロジェクト: phantomii/tavrida
# FOR RPC
# -------
# register remote service's exchanges to send there requests (RPC calls)
disc.register_remote_service("test_hello", "test_exchange")

# FOR SUBSCRIBE
# -------------
# register remote notification exchange to bind to it and get notifications
# In this example service 'test_subscribe' gets notifications to it's queue
# from 'test_notification_exchange' which is the publication exchange of
# service 'test_hello'
disc.register_remote_publisher("test_hello", "test_notification_exchange")

# FOR RPC AND SUBSCRIBE
# ---------------------
# start server on given queue and exchange
# The given queue will be used to obtain messages from other services (rpc
# and publishers).
# The given exchange will be used by other services to send there it's
# requests, responses, errors.

creds = config.Credentials("guest", "guest")
conf = config.ConnectionConfig("localhost", credentials=creds)
WorldController.set_discovery(disc)
ChuckController.set_discovery(disc)
srv = server.Server(conf,
                    queue_name="test_world_service",
                    exchange_name="test_world_exchange",
                    service_list=[WorldController, ChuckController])
srv.run()
コード例 #6
0
ファイル: test_driver.py プロジェクト: phantomii/tavrida
 def setUp(self):
     super(AMQPDriverSyncAndAsyncTestCase, self).setUp()
     self.user = "******"
     self.password = "******"
     self.credentials = config.Credentials(self.user, self.password)
     self.host = "host"