Connection Class

An AMQP Connection. A single Connection can have multiple Sessions, and can be shared between multiple Clients.

Inheritance
builtins.object
Connection

Constructor

Connection(hostname, sasl, container_id=False, max_frame_size=None, channel_max=None, idle_timeout=None, properties=None, remote_idle_timeout_empty_frame_send_ratio=None, error_policy=None, debug=False, encoding='UTF-8')

Parameters

Name Description
hostname
Required
bytes or str

The hostname of the AMQP service with which to establish a connection.

sasl
Required

Authentication for the connection. If none is provided SASL Annoymous authentication will be used.

container_id
str or bytes

The name for the client, also known as the Container ID. If no name is provided, a random GUID will be used.

Default value: False
max_frame_size
int

Maximum AMQP frame size. Default is 63488 bytes.

Default value: None
channel_max
int

Maximum number of Session channels in the Connection.

Default value: None
idle_timeout
int

Timeout in milliseconds after which the Connection will close if there is no further activity.

Default value: None
properties

Connection properties.

Default value: None
remote_idle_timeout_empty_frame_send_ratio

Ratio of empty frames to idle time for Connections with no activity. Value must be between 0.0 and 1.0 inclusive. Default is 0.5.

Default value: None
debug

Whether to turn on network trace logs. If True, trace logs will be logged at INFO level. Default is False.

Default value: False
encoding
str

The encoding to use for parameters supplied as strings. Default is 'UTF-8'

Default value: UTF-8
error_policy
Default value: None

Variables

Name Description
max_frame_size
int

Maximum AMQP frame size. Default is 63488 bytes.

channel_max
int

Maximum number of Session channels in the Connection.

idle_timeout
int

Timeout in milliseconds after which the Connection will close if there is no further activity.

properties

Connection properties.

Methods

destroy

Close the connection, and close any associated CBS authentication session.

lock
redirect

Redirect the connection to an alternative endpoint. :param redirect: The Link DETACH redirect details. :type redirect: ~uamqp.errors.LinkRedirect :param auth: Authentication credentials to the redirected endpoint. :type auth: ~uamqp.authentication.common.AMQPAuth

release
sleep

Lock the connection for a given number of seconds.

work

Perform a single Connection iteration.

destroy

Close the connection, and close any associated CBS authentication session.

destroy()

lock

lock(timeout=3.0)

Parameters

Name Description
timeout
Default value: 3.0

redirect

Redirect the connection to an alternative endpoint. :param redirect: The Link DETACH redirect details. :type redirect: ~uamqp.errors.LinkRedirect :param auth: Authentication credentials to the redirected endpoint. :type auth: ~uamqp.authentication.common.AMQPAuth

redirect(redirect_error, auth)

Parameters

Name Description
redirect_error
Required
auth
Required

release

release()

sleep

Lock the connection for a given number of seconds.

sleep(seconds)

Parameters

Name Description
seconds
Required
int

Length of time to lock the connection.

work

Perform a single Connection iteration.

work()

Attributes

channel_max

idle_timeout

max_frame_size

properties

remote_max_frame_size