Session Class

An AMQP Session. A Connection can have multiple Sessions, and each Session can have multiple Links.

Inheritance
builtins.object
Session

Constructor

Session(connection, incoming_window=None, outgoing_window=None, handle_max=None, on_attach=None)

Parameters

Name Description
connection
Required

The underlying Connection for the Session.

incoming_window
int

The size of the allowed window for incoming messages.

default value: None
outgoing_window
int

The size of the allowed window for outgoing messages.

default value: None
handle_max
int

The maximum number of concurrent link handles.

default value: None
on_attach

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

default value: None

Variables

Name Description
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

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

mgmt_request

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

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

destroy()

mgmt_request

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.

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

Parameters

Name Description
message
Required

The message to send in the management request.

operation
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

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.

default value: None
node

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

default value: b'$management'
timeout
Required

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

status_code_field
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
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
Required
str

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

Returns

Type Description

Attributes

handle_max

incoming_window

outgoing_window