MessageSenderAsync Class

An asynchronous Message Sender that opens its own exclsuive Link on an existing Session.

Inheritance
MessageSenderAsync

Constructor

MessageSenderAsync(session, source, target, name=None, send_settle_mode=<SenderSettleMode.Unsettled: 0>, receive_settle_mode=<ReceiverSettleMode.PeekLock: 1>, max_message_size=1048576, link_credit=None, properties=None, error_policy=None, debug=False, encoding='UTF-8', desired_capabilities=None, loop=None)

Parameters

session
SessionAsync
Required

The underlying Session with which to send.

source
str or bytes
Required

The name of source (i.e. the client).

target
Target
Required

The AMQP endpoint to send to.

name
str or bytes
default value: None

A unique name for the sender. If not specified a GUID will be used.

send_settle_mode
SenderSettleMode
default value: SenderSettleMode.Unsettled

The mode by which to settle message send operations. If set to Unsettled, the client will wait for a confirmation from the service that the message was successfully send. If set to 'Settled', the client will not wait for confirmation and assume success.

receive_settle_mode
ReceiverSettleMode
default value: ReceiverSettleMode.PeekLock

The mode by which to settle message receive operations. If set to PeekLock, the receiver will lock a message once received until the client accepts or rejects the message. If set to ReceiveAndDelete, the service will assume successful receipt of the message and clear it from the queue. The default is PeekLock.

desired_capabilities
AMQPValue
default value: 1048576

The extension capabilities desired from the peer endpoint. To create a desired_capabilities object, please do as follows:

    1. Create an array of desired capability symbols: capabilities_symbol_array = [types.AMQPSymbol(string)]
    1. Transform the array to AMQPValue object: utils.data_factory(types.AMQPArray(capabilities_symbol_array))
max_message_size
int
default value: None

The maximum allowed message size negotiated for the Link.

link_credit
int
default value: None

The sender Link credit that determines how many messages the Link will attempt to handle per connection iteration.

properties
dict
default value: None

Metadata to be sent in the Link ATTACH frame.

error_policy
ErrorPolicy
default value: False

A policy for parsing errors on link, connection and message disposition to determine whether the error should be retryable.

debug
bool
default value: UTF-8

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

encoding
str
default value: None

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

loop
default value: None

Variables

link_credit
int

The sender Link credit that determines how many messages the Link will attempt to handle per connection iteration.

properties
dict

Metadata to be sent in the Link ATTACH frame.

send_settle_mode
SenderSettleMode

The mode by which to settle message send operations. If set to Unsettled, the client will wait for a confirmation from the service that the message was successfully send. If set to 'Settled', the client will not wait for confirmation and assume success.

receive_settle_mode
ReceiverSettleMode

The mode by which to settle message receive operations. If set to PeekLock, the receiver will lock a message once received until the client accepts or rejects the message. If set to ReceiveAndDelete, the service will assume successful receipt of the message and clear it from the queue. The default is PeekLock.

max_message_size
int

The maximum allowed message size negotiated for the Link.

Methods

close_async

Close the sender asynchronously, leaving the link intact.

destroy_async

Asynchronously close both the Sender and the Link. Clean up any C objects.

open_async

Asynchronously open the MessageSender in order to start processing messages.

send_async

Add a single message to the internal pending queue to be processed by the Connection without waiting for it to be sent.

work_async

Update the link status.

close_async

Close the sender asynchronously, leaving the link intact.

async close_async()

destroy_async

Asynchronously close both the Sender and the Link. Clean up any C objects.

async destroy_async()

open_async

Asynchronously open the MessageSender in order to start processing messages.

async open_async()

Exceptions

uamqp.errors.AMQPConnectionError if the Sender raisesan error on opening. This can happen if the target URI is invalidor the credentials are rejected.

send_async

Add a single message to the internal pending queue to be processed by the Connection without waiting for it to be sent.

async send_async(message, callback, timeout=0)

Parameters

message
Message
Required

The message to send.

callback
callable[Message, MessageSendResult, MessageException]
Required

The callback to be run once a disposition is received in receipt of the message. The callback must take three arguments, the message, the send result and the optional delivery condition (exception).

timeout
default value: 0

An expiry time for the message added to the queue. If the message is not sent within this timeout it will be discarded with an error state. If set to 0, the message will not expire. The default is 0.

work_async

Update the link status.

async work_async()

Attributes

loop