Connection Class
An AMQP Connection. A single Connection can have multiple Sessions, and can be shared between multiple Clients.
- Inheritance
-
builtins.objectConnection
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
|
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
|
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
|
Maximum AMQP frame size. Default is 63488 bytes. Default value: None
|
channel_max
|
Maximum number of Session channels in the Connection. Default value: None
|
idle_timeout
|
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
|
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
|
Maximum AMQP frame size. Default is 63488 bytes. |
channel_max
|
Maximum number of Session channels in the Connection. |
idle_timeout
|
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
|
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
Azure SDK for Python
Feedback
https://aka.ms/ContentUserFeedback.
Coming soon: Throughout 2024 we will be phasing out GitHub Issues as the feedback mechanism for content and replacing it with a new feedback system. For more information see:Submit and view feedback for