예제 #1
0
 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
 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
    @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
    @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
    @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
    @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.
    """