SessionAsync Class

An asynchronous AMQP Session. A Connection can have multiple Sessions, and each Session can have multiple Links. An async Session must be used with an async Connection.

Inheritance
SessionAsync

Constructor

SessionAsync(connection, incoming_window=None, outgoing_window=None, handle_max=None, on_attach=None, loop=None)

Parameters

connection
ConnectionAsync
Required

The underlying Connection for the Session.

incoming_window
int
default value: None

The size of the allowed window for incoming messages.

outgoing_window
int
default value: None

The size of the allowed window for outgoing messages.

handle_max
int
default value: None

The maximum number of concurrent link handles.

on_attach
<xref:func>[Source, Target, dict, AMQPConnectionError]
default value: None

A callback function to be run on receipt of an ATTACH frame. The function must take 4 arguments: source, target, properties and error.

loop
default value: None

Variables

incoming_window
int

The size of the allowed window for incoming messages.

outgoing_window
int

The size of the allowed window for outgoing messages.

handle_max
int

The maximum number of concurrent link handles.

Methods

destroy_async

Asynchronously close any open management Links and close the Session. Cleans up and C objects for both mgmt Links and Session.

mgmt_request_async

Asynchronously run a request/response operation. These are frequently used for management tasks against a $management node, however any node name can be specified and the available options will depend on the target service.

destroy_async

Asynchronously close any open management Links and close the Session. Cleans up and C objects for both mgmt Links and Session.

async destroy_async()

mgmt_request_async

Asynchronously run a request/response operation. These are frequently used for management tasks against a $management node, however any node name can be specified and the available options will depend on the target service.

async mgmt_request_async(message, operation, op_type=None, node=b'$management', **kwargs)

Parameters

message
Message
Required

The message to send in the management request.

operation
bytes or str
Required

The type of operation to be performed. This value will be service-specific, but common values include READ, CREATE and UPDATE. This value will be added as an application property on the message.

op_type
bytes or str
default value: None

The type on which to carry out the operation. This will be specific to the entities of the service. This value will be added as an application property on the message.

node
bytes or str
default value: b'$management'

The target node. Default is b"$management".

timeout
float
Required

Provide an optional timeout in milliseconds within which a response to the management request must be received.

status_code_field
bytes or str
Required

Provide an alternate name for the status code in the response body which can vary between services due to the spec still being in draft. The default is b"statusCode".

description_fields
bytes or str
Required

Provide an alternate name for the description in the response body which can vary between services due to the spec still being in draft. The default is b"statusDescription".

encoding
str
Required

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

Return type

Attributes

loop