MessageReceiver Class
A Message Receiver that opens its own exclsuive Link on an existing Session.
- Inheritance
-
builtins.objectMessageReceiver
Constructor
MessageReceiver(session, source, target, on_message_received, name=None, receive_settle_mode=<ReceiverSettleMode.PeekLock: 1>, send_settle_mode=<SenderSettleMode.Unsettled: 0>, max_message_size=1048576, prefetch=300, properties=None, error_policy=None, debug=False, encoding='UTF-8', desired_capabilities=None)
Parameters
- 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.
- 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 sent. If set to 'Settled', the client will not wait for confirmation and assume success.
- 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))
- max_message_size
- int
The maximum allowed message size negotiated for the Link.
- prefetch
- int
The receiver 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'
- desired_capabilities
Variables
- 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.
- 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 sent. If set to 'Settled', the client will not wait for confirmation and assume success.
- max_message_size
- int
The maximum allowed message size negotiated for the Link.
Methods
| close |
Close the Receiver, leaving the link intact. |
| destroy |
Close both the Receiver and the Link. Clean up any C objects. |
| get_state |
Get the state of the MessageReceiver and its underlying Link. |
| on_state_changed |
Callback called whenever the underlying Receiver undergoes a change of state. This function can be overridden. |
| open |
Open the MessageReceiver in order to start processing messages. |
| reset_link_credit |
Reset the link credit. This method would send flow control frame to the sender. |
| work |
Update the link status. |
close
Close the Receiver, leaving the link intact.
close()
destroy
Close both the Receiver and the Link. Clean up any C objects.
destroy()
get_state
Get the state of the MessageReceiver and its underlying Link.
get_state()
Return type
on_state_changed
Callback called whenever the underlying Receiver undergoes a change of state. This function can be overridden.
on_state_changed(previous_state, new_state)
Parameters
open
Open the MessageReceiver in order to start processing messages.
open()
Exceptions
reset_link_credit
Reset the link credit. This method would send flow control frame to the sender.
reset_link_credit(link_credit, **kwargs)
Parameters
work
Update the link status.
work()
Attributes
max_message_size
receive_settle_mode
send_settle_mode
Feedback
Submit and view feedback for