From bcaaf2a0eb98a8ca537ee1bb17c4dd7bb95380f8 Mon Sep 17 00:00:00 2001 From: Yunhao Ling Date: Sat, 11 Jan 2020 17:09:06 -0800 Subject: [PATCH 1/4] Add desire capabilities to connection --- src/connection.pyx | 15 +++ .../inc/azure_uamqp_c/connection.h | 2 + src/vendor/azure-uamqp-c/src/connection.c | 113 ++++++++++++++++++ src/vendor/inc/c_connection.pxd | 2 + uamqp/client.py | 5 +- uamqp/connection.py | 16 ++- 6 files changed, 151 insertions(+), 2 deletions(-) diff --git a/src/connection.pyx b/src/connection.pyx index 0b166b21c..fcc343674 100644 --- a/src/connection.pyx +++ b/src/connection.pyx @@ -170,6 +170,21 @@ cdef class Connection(StructBase): if c_connection.connection_set_properties(self._c_value, value._c_value) != 0: self._value_error() + @property + def desired_capabilities(self): + cdef c_amqpvalue.AMQP_VALUE _value + if c_connection.connection_get_desired_capabilities(self._c_value, &_value) == 0: + if _value == NULL: + return None + return value_factory(_value) + else: + self._value_error() + + @desired_capabilities.setter + def desired_capabilities(self, AMQPValue value): + if c_connection.connection_set_desired_capabilities(self._c_value, value._c_value) != 0: + self._value_error() + @property def remote_max_frame_size(self): cdef stdint.uint32_t _value diff --git a/src/vendor/azure-uamqp-c/inc/azure_uamqp_c/connection.h b/src/vendor/azure-uamqp-c/inc/azure_uamqp_c/connection.h index 42018983f..9b8be11bd 100644 --- a/src/vendor/azure-uamqp-c/inc/azure_uamqp_c/connection.h +++ b/src/vendor/azure-uamqp-c/inc/azure_uamqp_c/connection.h @@ -90,6 +90,8 @@ extern "C" { MOCKABLE_FUNCTION(, int, connection_get_idle_timeout, CONNECTION_HANDLE, connection, milliseconds*, idle_timeout); MOCKABLE_FUNCTION(, int, connection_set_properties, CONNECTION_HANDLE, connection, fields, properties); MOCKABLE_FUNCTION(, int, connection_get_properties, CONNECTION_HANDLE, connection, fields*, properties); + MOCKABLE_FUNCTION(, int, connection_set_desired_capabilities, CONNECTION_HANDLE, connection, AMQP_VALUE, desired_capabilities); + MOCKABLE_FUNCTION(, int, connection_get_desired_capabilities, CONNECTION_HANDLE, connection, AMQP_VALUE*, desired_capabilities); MOCKABLE_FUNCTION(, int, connection_get_remote_max_frame_size, CONNECTION_HANDLE, connection, uint32_t*, remote_max_frame_size); MOCKABLE_FUNCTION(, int, connection_set_remote_idle_timeout_empty_frame_send_ratio, CONNECTION_HANDLE, connection, double, idle_timeout_empty_frame_send_ratio); MOCKABLE_FUNCTION(, uint64_t, connection_handle_deadlines, CONNECTION_HANDLE, connection); diff --git a/src/vendor/azure-uamqp-c/src/connection.c b/src/vendor/azure-uamqp-c/src/connection.c index 196d0ec3f..3f6d3f424 100644 --- a/src/vendor/azure-uamqp-c/src/connection.c +++ b/src/vendor/azure-uamqp-c/src/connection.c @@ -83,6 +83,7 @@ typedef struct CONNECTION_INSTANCE_TAG tickcounter_ms_t last_frame_received_time; tickcounter_ms_t last_frame_sent_time; fields properties; + AMQP_VALUE desired_capabilities; unsigned int is_underlying_io_open : 1; unsigned int idle_timeout_specified : 1; @@ -387,6 +388,19 @@ static int send_open_frame(CONNECTION_HANDLE connection) connection_set_state(connection, CONNECTION_STATE_END); result = __FAILURE__; } + else if ((connection->desired_capabilities != NULL) && + (open_set_desired_capabilities(open_performative, connection->desired_capabilities) != 0)) + { + LogError("Cannot set desired capabilities"); + + if(xio_close(connection->io, NULL, NULL) != 0) + { + LogError("xio_close failed"); + } + + connection_set_state(connection, CONNECTION_STATE_END); + result = __FAILURE__; + } else { AMQP_VALUE open_performative_value = amqpvalue_create_open(open_performative); @@ -1247,6 +1261,7 @@ CONNECTION_HANDLE connection_create2(XIO_HANDLE xio, const char* hostname, const connection->header_bytes_received = 0; connection->is_remote_frame_received = 0; connection->properties = NULL; + connection->desired_capabilities = NULL; connection->is_underlying_io_open = 0; connection->remote_max_frame_size = 512; @@ -1318,6 +1333,11 @@ void connection_destroy(CONNECTION_HANDLE connection) amqpvalue_destroy(connection->properties); } + if (connection->desired_capabilities != NULL) + { + amqpvalue_destroy(connection->desired_capabilities); + } + free(connection->host_name); free(connection->container_id); @@ -1731,6 +1751,99 @@ int connection_get_properties(CONNECTION_HANDLE connection, fields* properties) return result; } +int connection_set_desired_capabilities(CONNECTION_HANDLE connection, AMQP_VALUE desired_capabilities) +{ + int result; + + if (connection == NULL) + { + LogError("NULL connection"); + result = __FAILURE__; + } + else + { + if (connection->connection_state != CONNECTION_STATE_START) + { + LogError("Connection already open"); + result = __FAILURE__; + } + else + { + if (desired_capabilities == NULL) + { + if (connection->desired_capabilities != NULL) + { + fields_destroy(connection->desired_capabilities); + connection->desired_capabilities = NULL; + } + + result = 0; + } + else + { + AMQP_VALUE new_desired_capabilities; + + new_desired_capabilities = fields_clone(desired_capabilities); + if (new_desired_capabilities == NULL) + { + LogError("Cannot clone connection desired capabilities"); + result = __FAILURE__; + } + else + { + if (connection->desired_capabilities != NULL) + { + amqpvalue_destroy(connection->desired_capabilities); + } + + connection->desired_capabilities = new_desired_capabilities; + + result = 0; + } + } + } + } + + return result; +} + +int connection_get_desired_capabilities(CONNECTION_HANDLE connection, AMQP_VALUE* desired_capabilities) +{ + int result; + + if ((connection == NULL) || + (desired_capabilities == NULL)) + { + LogError("Bad arguments: connection = %p, desired capabilities = %p", + connection, desired_capabilities); + result = __FAILURE__; + } + else + { + if (connection->desired_capabilities == NULL) + { + *desired_capabilities = NULL; + + result = 0; + } + else + { + *desired_capabilities = amqpvalue_clone(connection->desired_capabilities); + if (*desired_capabilities == NULL) + { + LogError("Cannot clone desired capabilities"); + result = __FAILURE__; + } + else + { + result = 0; + } + } + } + + return result; +} + int connection_get_remote_max_frame_size(CONNECTION_HANDLE connection, uint32_t* remote_max_frame_size) { int result; diff --git a/src/vendor/inc/c_connection.pxd b/src/vendor/inc/c_connection.pxd index 7f03130f0..785fd3be3 100644 --- a/src/vendor/inc/c_connection.pxd +++ b/src/vendor/inc/c_connection.pxd @@ -56,6 +56,8 @@ cdef extern from "azure_uamqp_c/connection.h": int connection_get_idle_timeout(CONNECTION_HANDLE connection, c_amqp_definitions.milliseconds* idle_timeout) int connection_set_properties(CONNECTION_HANDLE connection, c_amqp_definitions.fields properties) int connection_get_properties(CONNECTION_HANDLE connection, c_amqp_definitions.fields* properties) + int connection_set_desired_capabilities(CONNECTION_HANDLE connection, c_amqpvalue.AMQP_VALUE desired_capabilities) + int connection_get_desired_capabilities(CONNECTION_HANDLE connection, c_amqpvalue.AMQP_VALUE* desired_capabilities) int connection_get_remote_max_frame_size(CONNECTION_HANDLE connection, stdint.uint32_t* remote_max_frame_size) int connection_set_remote_idle_timeout_empty_frame_send_ratio(CONNECTION_HANDLE connection, double idle_timeout_empty_frame_send_ratio) stdint.uint64_t connection_handle_deadlines(CONNECTION_HANDLE connection) diff --git a/uamqp/client.py b/uamqp/client.py index e2cd1af0e..06305bf11 100644 --- a/uamqp/client.py +++ b/uamqp/client.py @@ -126,6 +126,7 @@ def __init__( self._properties = kwargs.pop('properties', None) self._remote_idle_timeout_empty_frame_send_ratio = kwargs.pop( 'remote_idle_timeout_empty_frame_send_ratio', None) + self._connection_desired_capabilities = kwargs.pop("connection_desired_capabilities", None) # Session settings self._outgoing_window = kwargs.pop('outgoing_window', None) or constants.MAX_FRAME_SIZE_BYTES @@ -255,7 +256,9 @@ def open(self, connection=None): remote_idle_timeout_empty_frame_send_ratio=self._remote_idle_timeout_empty_frame_send_ratio, error_policy=self._error_policy, debug=self._debug_trace, - encoding=self._encoding) + encoding=self._encoding, + desired_capabilities=self._connection_desired_capabilities + ) self._build_session() if self._keep_alive_interval: self._keep_alive_thread = threading.Thread(target=self._keep_alive) diff --git a/uamqp/connection.py b/uamqp/connection.py index a5703c5d1..07efb1f23 100644 --- a/uamqp/connection.py +++ b/uamqp/connection.py @@ -69,7 +69,8 @@ def __init__(self, hostname, sasl, remote_idle_timeout_empty_frame_send_ratio=None, error_policy=None, debug=False, - encoding='UTF-8'): + encoding='UTF-8', + desired_capabilities=None): uamqp._Platform.initialize() # pylint: disable=protected-access self.container_id = container_id if container_id else str(uuid.uuid4()) if isinstance(self.container_id, six.text_type): @@ -102,6 +103,8 @@ def __init__(self, hostname, sasl, self.properties = properties if remote_idle_timeout_empty_frame_send_ratio: self._conn.remote_idle_timeout_empty_frame_send_ratio = remote_idle_timeout_empty_frame_send_ratio + if desired_capabilities: + self.desired_capabilities = desired_capabilities def __enter__(self): """Open the Connection in a context manager.""" @@ -310,6 +313,17 @@ def properties(self, value): raise TypeError("Connection properties must be a dictionary.") self._conn.properties = utils.data_factory(value, encoding=self._encoding) + @property + def desired_capabilities(self): + return self._conn.desired_capabilities + + @desired_capabilities.setter + def desired_capabilities(self, value): + if not isinstance(value, uamqp.c_uamqp.AMQPValue): + raise TypeError("Connection desired capabilities must be type of uamqp.c_uamqp.AMQPValue.\ + Please use uamqp.utils.data_factory method to encode desired capabilities first") + self._conn.desired_capabilities = value + @property def remote_max_frame_size(self): return self._conn.remote_max_frame_size From 8aea26add50f67478b356eaa8f7a187e4f90f677 Mon Sep 17 00:00:00 2001 From: Yunhao Ling Date: Fri, 17 Jan 2020 15:25:33 -0800 Subject: [PATCH 2/4] update implementation --- uamqp/async_ops/client_async.py | 15 ++++++++++----- uamqp/async_ops/connection_async.py | 7 +++++++ uamqp/async_ops/receiver_async.py | 4 ++-- uamqp/client.py | 15 ++++++++++----- uamqp/connection.py | 9 +++++++-- uamqp/receiver.py | 4 ++-- 6 files changed, 38 insertions(+), 16 deletions(-) diff --git a/uamqp/async_ops/client_async.py b/uamqp/async_ops/client_async.py index 69d4939fd..07f35768d 100644 --- a/uamqp/async_ops/client_async.py +++ b/uamqp/async_ops/client_async.py @@ -65,6 +65,16 @@ class AMQPClientAsync(client.AMQPClient): :type idle_timeout: int :param properties: Connection properties. :type properties: dict + :param desired_capabilities: The extension capabilities desired from the peer endpoint to be sent in the link ATTACH frame. + To create an desired_capabilities object, please do as follows: + - 1. Create an array of desired capability symbols: `capabilities_symbol_array = [types.AMQPSymbol(string)]` + - 2. Transform the array to AMQPValue object: `utils.data_factory(types.AMQPArray(capabilities_symbol_array))` + :type desired_capabilities: ~uamqp.c_uamqp.AMQPValue + :param connection_desired_capabilities: The extension capabilities desired from the peer endpoint to be sent in the connection OPEN frame. + To create a desired_capabilities object, please do as follows: + - 1. Create an array of desired capability symbols: `capabilities_symbol_array = [types.AMQPSymbol(string)]` + - 2. Transform the array to AMQPValue object: `utils.data_factory(types.AMQPArray(capabilities_symbol_array))` + :type connection_desired_capabilities: ~uamqp.c_uamqp.AMQPValue :param remote_idle_timeout_empty_frame_send_ratio: Ratio of empty frames to idle time for Connections with no activity. Value must be between 0.0 and 1.0 inclusive. Default is 0.5. @@ -718,11 +728,6 @@ class ReceiveClientAsync(client.ReceiveClient, AMQPClientAsync): will assume successful receipt of the message and clear it from the queue. The default is `PeekLock`. :type receive_settle_mode: ~uamqp.constants.ReceiverSettleMode - :param desired_capabilities: The extension capabilities desired from the peer endpoint. - To create an desired_capabilities object, please do as follows: - - 1. Create an array of desired capability symbols: `capabilities_symbol_array = [types.AMQPSymbol(string)]` - - 2. Transform the array to AMQPValue object: `utils.data_factory(types.AMQPArray(capabilities_symbol_array))` - :type desired_capabilities: ~uamqp.c_uamqp.AMQPValue :param max_message_size: The maximum allowed message size negotiated for the Link. :type max_message_size: int :param link_properties: Metadata to be sent in the Link ATTACH frame. diff --git a/uamqp/async_ops/connection_async.py b/uamqp/async_ops/connection_async.py index 1fd379f8c..e31eeb691 100644 --- a/uamqp/async_ops/connection_async.py +++ b/uamqp/async_ops/connection_async.py @@ -46,6 +46,11 @@ class ConnectionAsync(connection.Connection): :type idle_timeout: int :param properties: Connection properties. :type properties: dict + :param desired_capabilities: The extension capabilities desired from the peer endpoint to be sent in the connection OPEN frame. + To create a desired_capabilities object, please do as follows: + - 1. Create an array of desired capability symbols: `capabilities_symbol_array = [types.AMQPSymbol(string)]` + - 2. Transform the array to AMQPValue object: `utils.data_factory(types.AMQPArray(capabilities_symbol_array))` + :type desired_capabilities: ~uamqp.c_uamqp.AMQPValue :param remote_idle_timeout_empty_frame_send_ratio: Ratio of empty frames to idle time for Connections with no activity. Value must be between 0.0 and 1.0 inclusive. Default is 0.5. @@ -66,6 +71,7 @@ def __init__(self, hostname, sasl, channel_max=None, idle_timeout=None, properties=None, + desired_capabilities=None, remote_idle_timeout_empty_frame_send_ratio=None, error_policy=None, debug=False, @@ -79,6 +85,7 @@ def __init__(self, hostname, sasl, channel_max=channel_max, idle_timeout=idle_timeout, properties=properties, + desired_capabilities=desired_capabilities, remote_idle_timeout_empty_frame_send_ratio=remote_idle_timeout_empty_frame_send_ratio, error_policy=error_policy, debug=debug, diff --git a/uamqp/async_ops/receiver_async.py b/uamqp/async_ops/receiver_async.py index aeee79978..f932d629b 100644 --- a/uamqp/async_ops/receiver_async.py +++ b/uamqp/async_ops/receiver_async.py @@ -50,8 +50,8 @@ class MessageReceiverAsync(receiver.MessageReceiver): from the service that the message was successfully sent. If set to 'Settled', the client will not wait for confirmation and assume success. :type send_settle_mode: ~uamqp.constants.SenderSettleMode - :param desired_capabilities: The extension capabilities desired from the peer endpoint. - To create an desired_capabilities object, please do as follows: + :param desired_capabilities: The extension capabilities desired from the peer endpoint to be sent in the link ATTACH frame. + To create a desired_capabilities object, please do as follows: - 1. Create an array of desired capability symbols: `capabilities_symbol_array = [types.AMQPSymbol(string)]` - 2. Transform the array to AMQPValue object: `utils.data_factory(types.AMQPArray(capabilities_symbol_array))` :type desired_capabilities: ~uamqp.c_uamqp.AMQPValue diff --git a/uamqp/client.py b/uamqp/client.py index 06305bf11..0a66a8dc7 100644 --- a/uamqp/client.py +++ b/uamqp/client.py @@ -54,6 +54,16 @@ class AMQPClient(object): :type idle_timeout: int :param properties: Connection properties. :type properties: dict + :param desired_capabilities: The extension capabilities desired from the peer endpoint to be sent in the link ATTACH frame. + To create an desired_capabilities object, please do as follows: + - 1. Create an array of desired capability symbols: `capabilities_symbol_array = [types.AMQPSymbol(string)]` + - 2. Transform the array to AMQPValue object: `utils.data_factory(types.AMQPArray(capabilities_symbol_array))` + :type desired_capabilities: ~uamqp.c_uamqp.AMQPValue + :param connection_desired_capabilities: The extension capabilities desired from the peer endpoint to be sent in the connection OPEN frame. + To create a desired_capabilities object, please do as follows: + - 1. Create an array of desired capability symbols: `capabilities_symbol_array = [types.AMQPSymbol(string)]` + - 2. Transform the array to AMQPValue object: `utils.data_factory(types.AMQPArray(capabilities_symbol_array))` + :type connection_desired_capabilities: ~uamqp.c_uamqp.AMQPValue :param remote_idle_timeout_empty_frame_send_ratio: Ratio of empty frames to idle time for Connections with no activity. Value must be between 0.0 and 1.0 inclusive. Default is 0.5. @@ -826,11 +836,6 @@ class ReceiveClient(AMQPClient): will assume successful receipt of the message and clear it from the queue. The default is `PeekLock`. :type receive_settle_mode: ~uamqp.constants.ReceiverSettleMode - :param desired_capabilities: The extension capabilities desired from the peer endpoint. - To create an desired_capabilities object, please do as follows: - - 1. Create an array of desired capability symbols: `capabilities_symbol_array = [types.AMQPSymbol(string)]` - - 2. Transform the array to AMQPValue object: `utils.data_factory(types.AMQPArray(capabilities_symbol_array))` - :type desired_capabilities: ~uamqp.c_uamqp.AMQPValue :param max_message_size: The maximum allowed message size negotiated for the Link. :type max_message_size: int :param link_properties: Metadata to be sent in the Link ATTACH frame. diff --git a/uamqp/connection.py b/uamqp/connection.py index 07efb1f23..6815858ca 100644 --- a/uamqp/connection.py +++ b/uamqp/connection.py @@ -48,6 +48,11 @@ class Connection(object): :type idle_timeout: int :param properties: Connection properties. :type properties: dict + :param desired_capabilities: The extension capabilities desired from the peer endpoint to be sent in the connection OPEN frame. + To create a desired_capabilities object, please do as follows: + - 1. Create an array of desired capability symbols: `capabilities_symbol_array = [types.AMQPSymbol(string)]` + - 2. Transform the array to AMQPValue object: `utils.data_factory(types.AMQPArray(capabilities_symbol_array))` + :type desired_capabilities: ~uamqp.c_uamqp.AMQPValue :param remote_idle_timeout_empty_frame_send_ratio: Ratio of empty frames to idle time for Connections with no activity. Value must be between 0.0 and 1.0 inclusive. Default is 0.5. @@ -66,11 +71,11 @@ def __init__(self, hostname, sasl, channel_max=None, idle_timeout=None, properties=None, + desired_capabilities=None, remote_idle_timeout_empty_frame_send_ratio=None, error_policy=None, debug=False, - encoding='UTF-8', - desired_capabilities=None): + encoding='UTF-8'): uamqp._Platform.initialize() # pylint: disable=protected-access self.container_id = container_id if container_id else str(uuid.uuid4()) if isinstance(self.container_id, six.text_type): diff --git a/uamqp/receiver.py b/uamqp/receiver.py index 27ae2ea74..4537f2335 100644 --- a/uamqp/receiver.py +++ b/uamqp/receiver.py @@ -52,8 +52,8 @@ class MessageReceiver(object): from the service that the message was successfully sent. If set to 'Settled', the client will not wait for confirmation and assume success. :type send_settle_mode: ~uamqp.constants.SenderSettleMode - :param desired_capabilities: The extension capabilities desired from the peer endpoint. - To create an desired_capabilities object, please do as follows: + :param desired_capabilities: The extension capabilities desired from the peer endpoint to be sent in the link ATTACH frame. + To create a desired_capabilities object, please do as follows: - 1. Create an array of desired capability symbols: `capabilities_symbol_array = [types.AMQPSymbol(string)]` - 2. Transform the array to AMQPValue object: `utils.data_factory(types.AMQPArray(capabilities_symbol_array))` :type desired_capabilities: ~uamqp.c_uamqp.AMQPValue From aed814ff67d48e77f64644fee9621b12f19a4085 Mon Sep 17 00:00:00 2001 From: Yunhao Ling Date: Fri, 17 Jan 2020 15:56:01 -0800 Subject: [PATCH 3/4] fix pylint --- uamqp/async_ops/client_async.py | 6 ++++-- uamqp/async_ops/connection_async.py | 3 ++- uamqp/async_ops/receiver_async.py | 3 ++- uamqp/client.py | 6 ++++-- uamqp/connection.py | 3 ++- uamqp/receiver.py | 3 ++- 6 files changed, 16 insertions(+), 8 deletions(-) diff --git a/uamqp/async_ops/client_async.py b/uamqp/async_ops/client_async.py index 07f35768d..be508cece 100644 --- a/uamqp/async_ops/client_async.py +++ b/uamqp/async_ops/client_async.py @@ -65,12 +65,14 @@ class AMQPClientAsync(client.AMQPClient): :type idle_timeout: int :param properties: Connection properties. :type properties: dict - :param desired_capabilities: The extension capabilities desired from the peer endpoint to be sent in the link ATTACH frame. + :param desired_capabilities: The extension capabilities desired from the peer + endpoint to be sent in the link ATTACH frame. To create an desired_capabilities object, please do as follows: - 1. Create an array of desired capability symbols: `capabilities_symbol_array = [types.AMQPSymbol(string)]` - 2. Transform the array to AMQPValue object: `utils.data_factory(types.AMQPArray(capabilities_symbol_array))` :type desired_capabilities: ~uamqp.c_uamqp.AMQPValue - :param connection_desired_capabilities: The extension capabilities desired from the peer endpoint to be sent in the connection OPEN frame. + :param connection_desired_capabilities: The extension capabilities desired from the + peer endpoint to be sent in the connection OPEN frame. To create a desired_capabilities object, please do as follows: - 1. Create an array of desired capability symbols: `capabilities_symbol_array = [types.AMQPSymbol(string)]` - 2. Transform the array to AMQPValue object: `utils.data_factory(types.AMQPArray(capabilities_symbol_array))` diff --git a/uamqp/async_ops/connection_async.py b/uamqp/async_ops/connection_async.py index e31eeb691..8bf99547a 100644 --- a/uamqp/async_ops/connection_async.py +++ b/uamqp/async_ops/connection_async.py @@ -46,7 +46,8 @@ class ConnectionAsync(connection.Connection): :type idle_timeout: int :param properties: Connection properties. :type properties: dict - :param desired_capabilities: The extension capabilities desired from the peer endpoint to be sent in the connection OPEN frame. + :param desired_capabilities: The extension capabilities desired from the peer + endpoint to be sent in the connection OPEN frame. To create a desired_capabilities object, please do as follows: - 1. Create an array of desired capability symbols: `capabilities_symbol_array = [types.AMQPSymbol(string)]` - 2. Transform the array to AMQPValue object: `utils.data_factory(types.AMQPArray(capabilities_symbol_array))` diff --git a/uamqp/async_ops/receiver_async.py b/uamqp/async_ops/receiver_async.py index f932d629b..4f8940ffc 100644 --- a/uamqp/async_ops/receiver_async.py +++ b/uamqp/async_ops/receiver_async.py @@ -50,7 +50,8 @@ class MessageReceiverAsync(receiver.MessageReceiver): from the service that the message was successfully sent. If set to 'Settled', the client will not wait for confirmation and assume success. :type send_settle_mode: ~uamqp.constants.SenderSettleMode - :param desired_capabilities: The extension capabilities desired from the peer endpoint to be sent in the link ATTACH frame. + :param desired_capabilities: The extension capabilities desired from the peer + endpoint to be sent in the link ATTACH frame. To create a desired_capabilities object, please do as follows: - 1. Create an array of desired capability symbols: `capabilities_symbol_array = [types.AMQPSymbol(string)]` - 2. Transform the array to AMQPValue object: `utils.data_factory(types.AMQPArray(capabilities_symbol_array))` diff --git a/uamqp/client.py b/uamqp/client.py index 0a66a8dc7..14747a022 100644 --- a/uamqp/client.py +++ b/uamqp/client.py @@ -54,12 +54,14 @@ class AMQPClient(object): :type idle_timeout: int :param properties: Connection properties. :type properties: dict - :param desired_capabilities: The extension capabilities desired from the peer endpoint to be sent in the link ATTACH frame. + :param desired_capabilities: The extension capabilities desired from the peer + endpoint to be sent in the link ATTACH frame. To create an desired_capabilities object, please do as follows: - 1. Create an array of desired capability symbols: `capabilities_symbol_array = [types.AMQPSymbol(string)]` - 2. Transform the array to AMQPValue object: `utils.data_factory(types.AMQPArray(capabilities_symbol_array))` :type desired_capabilities: ~uamqp.c_uamqp.AMQPValue - :param connection_desired_capabilities: The extension capabilities desired from the peer endpoint to be sent in the connection OPEN frame. + :param connection_desired_capabilities: The extension capabilities desired from the peer + endpoint to be sent in the connection OPEN frame. To create a desired_capabilities object, please do as follows: - 1. Create an array of desired capability symbols: `capabilities_symbol_array = [types.AMQPSymbol(string)]` - 2. Transform the array to AMQPValue object: `utils.data_factory(types.AMQPArray(capabilities_symbol_array))` diff --git a/uamqp/connection.py b/uamqp/connection.py index 6815858ca..903647289 100644 --- a/uamqp/connection.py +++ b/uamqp/connection.py @@ -48,7 +48,8 @@ class Connection(object): :type idle_timeout: int :param properties: Connection properties. :type properties: dict - :param desired_capabilities: The extension capabilities desired from the peer endpoint to be sent in the connection OPEN frame. + :param desired_capabilities: The extension capabilities desired from the peer + endpoint to be sent in the connection OPEN frame. To create a desired_capabilities object, please do as follows: - 1. Create an array of desired capability symbols: `capabilities_symbol_array = [types.AMQPSymbol(string)]` - 2. Transform the array to AMQPValue object: `utils.data_factory(types.AMQPArray(capabilities_symbol_array))` diff --git a/uamqp/receiver.py b/uamqp/receiver.py index 4537f2335..36b767cd1 100644 --- a/uamqp/receiver.py +++ b/uamqp/receiver.py @@ -52,7 +52,8 @@ class MessageReceiver(object): from the service that the message was successfully sent. If set to 'Settled', the client will not wait for confirmation and assume success. :type send_settle_mode: ~uamqp.constants.SenderSettleMode - :param desired_capabilities: The extension capabilities desired from the peer endpoint to be sent in the link ATTACH frame. + :param desired_capabilities: The extension capabilities desired from the peer + endpoint to be sent in the link ATTACH frame. To create a desired_capabilities object, please do as follows: - 1. Create an array of desired capability symbols: `capabilities_symbol_array = [types.AMQPSymbol(string)]` - 2. Transform the array to AMQPValue object: `utils.data_factory(types.AMQPArray(capabilities_symbol_array))` From 8ea1eb7743a1890047dd65f29a3591f342872e4d Mon Sep 17 00:00:00 2001 From: Yunhao Ling Date: Fri, 17 Jan 2020 16:22:56 -0800 Subject: [PATCH 4/4] small fix --- uamqp/receiver.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/uamqp/receiver.py b/uamqp/receiver.py index 36b767cd1..5747f7616 100644 --- a/uamqp/receiver.py +++ b/uamqp/receiver.py @@ -52,7 +52,7 @@ class MessageReceiver(object): from the service that the message was successfully sent. If set to 'Settled', the client will not wait for confirmation and assume success. :type send_settle_mode: ~uamqp.constants.SenderSettleMode - :param desired_capabilities: The extension capabilities desired from the peer + :param desired_capabilities: The extension capabilities desired from the peer endpoint to be sent in the link ATTACH frame. To create a desired_capabilities object, please do as follows: - 1. Create an array of desired capability symbols: `capabilities_symbol_array = [types.AMQPSymbol(string)]`