コード例 #1
0
ファイル: checks.py プロジェクト: tomwardill/conn-check
 def do_auth():
     """Connect and authenticate."""
     delegate = TwistedDelegate()
     spec = load_spec(resource_stream('conn_check', 'amqp0-8.xml'))
     creator = ClientCreator(reactor, AMQClient, delegate, vhost, spec)
     client = yield creator.connectTCP(host, port, timeout=timeout)
     yield client.authenticate(username, password)
コード例 #2
0
ファイル: checks.py プロジェクト: canonical-ols/conn-check
 def do_auth():
     """Connect and authenticate."""
     delegate = TwistedDelegate()
     spec = load_spec(resource_stream('conn_check', 'amqp0-8.xml'))
     creator = ClientCreator(reactor, AMQClient,
                             delegate, vhost, spec)
     client = yield creator.connectTCP(host, port, timeout=timeout)
     yield client.authenticate(username, password)
コード例 #3
0
ファイル: service.py プロジェクト: SMAC/corelib
 def __init__(self, specs, host='localhost', port=5672, vhost='/',
         user='******', password='******', channel=1):
     
     self.specs = load_spec(specs)
     self.delegate = ThriftTwistedDelegate()
     self.protocol = ThriftAMQClient
     self.vhost = vhost
     self.host = host
     self.port = port
     self.user = user
     self.password = password
     self.channel = channel
     
     super(AMQService, self).__init__()
コード例 #4
0
ファイル: amqpclient.py プロジェクト: deepakhajare/maas
    @ivar connected_callback: callback called when C{connectionMade} is
        called. It takes one argument, the protocol instance itself.
    """

    def __init__(self, connected_callback, *args, **kwargs):
        AMQClient.__init__(self, *args, **kwargs)
        self.connected_callback = connected_callback

    def connectionMade(self):
        AMQClient.connectionMade(self)
        self.connected_callback(self)


_base_dir = os.path.dirname(os.path.abspath(__file__))
AMQP0_8_SPEC = load_spec(os.path.join(_base_dir, "specs", "amqp0-8.xml"))
del _base_dir


class AMQFactory(ReconnectingClientFactory):
    """
    A C{ClientFactory} for C{AMQClient} protocol with reconnecting facilities.

    @ivar user: the user name to use to connect to the AMQP server.
    @ivar password: the corresponding password of the user.
    @ivar vhost: the AMQP vhost to create connections against.
    @ivar connected_callback: callback called when a successful connection
        happened. It takes one argument, the channel opened for the connection.
    @ivar disconnected_callback: callback called when a previously connected
        connection was lost. It takes no argument.
    """
コード例 #5
0
ファイル: client.py プロジェクト: CanonicalLtd/txlongpoll
    @ivar connected_callback: callback called when C{connectionMade} is
        called. It takes one argument, the protocol instance itself.
    """
    def __init__(self, connected_callback, *args, **kwargs):
        AMQClient.__init__(self, *args, **kwargs)
        self.connected_callback = connected_callback

    def connectionMade(self):
        AMQClient.connectionMade(self)
        self.connected_callback(self)


_base_dir = os.path.dirname(os.path.abspath(__file__))
AMQP0_8_SPEC_PATH = os.path.join(_base_dir, "specs", "amqp0-8.xml")
AMQP0_8_SPEC = load_spec(AMQP0_8_SPEC_PATH)
del _base_dir


class AMQFactory(ReconnectingClientFactory):
    """
    A C{ClientFactory} for C{AMQClient} protocol with reconnecting facilities.

    @ivar user: the user name to use to connect to the AMQP server.
    @ivar password: the corresponding password of the user.
    @ivar vhost: the AMQP vhost to create connections against.
    @ivar connected_callback: callback called when a successful connection
        happened. It takes one argument, the channel opened for the connection.
    @ivar disconnected_callback: callback called when a previously connected
        connection was lost. It takes no argument.
    """
コード例 #6
0
ファイル: amqpclient.py プロジェクト: cloudbase/maas
    @ivar connected_callback: callback called when C{connectionMade} is
        called. It takes one argument, the protocol instance itself.
    """

    def __init__(self, connected_callback, *args, **kwargs):
        AMQClient.__init__(self, *args, **kwargs)
        self.connected_callback = connected_callback

    def connectionMade(self):
        AMQClient.connectionMade(self)
        self.connected_callback(self)


_base_dir = os.path.dirname(os.path.abspath(__file__))
AMQP0_8_SPEC = load_spec(os.path.join(_base_dir, "specs", "amqp0-8.xml"))
del _base_dir


class AMQFactory(ReconnectingClientFactory):
    """
    A C{ClientFactory} for C{AMQClient} protocol with reconnecting facilities.

    @ivar user: the user name to use to connect to the AMQP server.
    @ivar password: the corresponding password of the user.
    @ivar vhost: the AMQP vhost to create connections against.
    @ivar connected_callback: callback called when a successful connection
        happened. It takes one argument, the channel opened for the connection.
    @ivar disconnected_callback: callback called when a previously connected
        connection was lost. It takes no argument.
    """
コード例 #7
0
ファイル: client.py プロジェクト: CanonicalLtd/txlongpoll
    @ivar connected_callback: callback called when C{connectionMade} is
        called. It takes one argument, the protocol instance itself.
    """

    def __init__(self, connected_callback, *args, **kwargs):
        AMQClient.__init__(self, *args, **kwargs)
        self.connected_callback = connected_callback

    def connectionMade(self):
        AMQClient.connectionMade(self)
        self.connected_callback(self)


_base_dir = os.path.dirname(os.path.abspath(__file__))
AMQP0_8_SPEC_PATH = os.path.join(_base_dir, "specs", "amqp0-8.xml")
AMQP0_8_SPEC = load_spec(AMQP0_8_SPEC_PATH)
del _base_dir


class AMQFactory(ReconnectingClientFactory):
    """
    A C{ClientFactory} for C{AMQClient} protocol with reconnecting facilities.

    @ivar user: the user name to use to connect to the AMQP server.
    @ivar password: the corresponding password of the user.
    @ivar vhost: the AMQP vhost to create connections against.
    @ivar connected_callback: callback called when a successful connection
        happened. It takes one argument, the channel opened for the connection.
    @ivar disconnected_callback: callback called when a previously connected
        connection was lost. It takes no argument.
    """