app.celery.MyCelery.connection

MyCelery.connection(hostname=None, userid=None, password=None, virtual_host=None, port=None, ssl=None, connect_timeout=None, transport=None, transport_options=None, heartbeat=None, login_method=None, failover_strategy=None, **kwargs)

Establish a connection to the message broker.

Please use connection_for_read() and connection_for_write() instead, to convey the intent of use for this connection.

Parameters
  • url – Either the URL or the hostname of the broker to use.

  • hostname (str) – URL, Hostname/IP-address of the broker. If a URL is used, then the other argument below will be taken from the URL instead.

  • userid (str) – Username to authenticate as.

  • password (str) – Password to authenticate with

  • virtual_host (str) – Virtual host to use (domain).

  • port (int) – Port to connect to.

  • ssl (bool, Dict) – Defaults to the :setting:`broker_use_ssl` setting.

  • transport (str) – defaults to the :setting:`broker_transport` setting.

  • transport_options (Dict) – Dictionary of transport specific options.

  • heartbeat (int) – AMQP Heartbeat in seconds (pyamqp only).

  • login_method (str) – Custom login method to use (AMQP only).

  • failover_strategy (str, Callable) – Custom failover strategy.

  • **kwargs – Additional arguments to kombu.Connection.

Returns

the lazy connection instance.

Return type

kombu.Connection