carrot.connection
Getting a connection to the AMQP server.
-
class carrot.connection.AMQPConnection(hostname, userid, password, virtual_host=None, port=None, **kwargs)
A network/socket connection to an AMQP message broker.
-
hostname
- The hostname to the AMQP server
-
userid
- A valid username used to authenticate to the server.
-
password
- The password used to authenticate to the server.
-
virtual_host
- The name of the virtual host to work with. This virtual host must
exist on the server, and the user must have access to it. Consult
your brokers manual for help with creating, and mapping
users to virtual hosts.
Default is "/".
-
port
- The port of the AMQP server. Default is 5672 (amqp).
-
insist
- Insist on connecting to a server. In a configuration with multiple
load-sharing servers, the insist option tells the server that the
client is insisting on a connection to the specified server.
Default is False.
-
connect_timeout
- The timeout in seconds before we give up connecting to the server.
The default is no timeout.
-
ssl
- Use SSL to connect to the server.
The default is False.
-
close()
- Close the currently open connection.
-
connect()
- Establish a connection to the AMQP server.
-
host
- The host as a hostname/port pair separated by colon.
-
class carrot.connection.DjangoAMQPConnection(*args, **kwargs)
A version of AMQPConnection that takes configuration
from the Django settings.py module.
Parameters: |
- hostname – The hostname of the AMQP server to connect to,
if not provided this is taken from settings.AMQP_SERVER.
- userid – The username of the user to authenticate to the server
as. If not provided this is taken from settings.AMQP_USER.
- password – The users password. If not provided this is taken
from settings.AMQP_PASSWORD.
- vhost – The name of the virtual host to work with.
This virtual host must exist on the server, and the user must
have access to it. Consult your brokers manual for help with
creating, and mapping users to virtual hosts. If not provided
this is taken from settings.AMQP_VHOST.
- port – The port the AMQP server is running on. If not provided
this is taken from settings.AMQP_PORT, or if that is not set,
the default is 5672 (amqp).
|
-
class carrot.connection.DummyConnection(*args, **kwargs)
A connection class that does nothing, for non-networked backends.
-
close()
- Doesn’t do anything. Just for API compatibility.
-
connect()
- Doesn’t do anything. Just for API compatibility.
-
host
- Always empty string.