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
A unique name for the sender. If not specified a GUID will be used.
- 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.
- desired_capabilities
- AMQPValue
The extension capabilities desired from the peer endpoint. To create a desired_capabilities object, please do as follows:
-
- Create an array of desired capability symbols: capabilities_symbol_array = [types.AMQPSymbol(string)]
-
- Transform the array to AMQPValue object: utils.data_factory(types.AMQPArray(capabilities_symbol_array))
- link_credit
- int
The sender Link credit that determines how many messages the Link will attempt to handle per connection iteration.
- error_policy
- ErrorPolicy
A policy for parsing errors on link, connection and message disposition to determine whether the error should be retryable.
- debug
- bool
Whether to turn on network trace logs. If True, trace logs will be logged at INFO level. Default is False.
- encoding
- str
The encoding to use for parameters supplied as strings. Default is 'UTF-8'
- loop
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
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
- callback
- callable[Message, MessageSendResult, MessageException]
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
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
Feedback
Submit and view feedback for