Skip to content

Commit ce40401

Browse files
fix(servicebus): add create_mgmt_client_async to UamqpTransportAsync
_SessionBrowserAsync calls self._amqp_transport.create_mgmt_client_async(...) but the uamqp async transport never exposed it, so list_queue_sessions / list_subscription_sessions on the async client would AttributeError when uamqp_transport=True. Added the factory mirroring the sync UamqpTransport.create_mgmt_client implementation.
1 parent 5c925c1 commit ce40401

1 file changed

Lines changed: 23 additions & 0 deletions

File tree

sdk/servicebus/azure-servicebus/azure/servicebus/aio/_transport/_uamqp_transport_async.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
try:
1111
from uamqp import (
1212
constants,
13+
AMQPClientAsync,
1314
SendClientAsync,
1415
ReceiveClientAsync,
1516
)
@@ -64,6 +65,28 @@ async def close_connection_async(connection: "ConnectionAsync") -> None:
6465
"""
6566
await connection.destroy_async()
6667

68+
@staticmethod
69+
def create_mgmt_client_async(config: "Configuration", **kwargs: Any) -> "AMQPClientAsync":
70+
"""Creates and returns an async uamqp AMQPClient for management-only operations.
71+
72+
:param ~azure.servicebus._common._configuration.Configuration config: The configuration.
73+
:keyword JWTTokenAuthAsync auth: Required.
74+
:keyword retry_policy: Required.
75+
:keyword str client_name: Required.
76+
:keyword dict properties: Required.
77+
:return: AMQPClientAsync
78+
:rtype: ~uamqp.AMQPClientAsync
79+
"""
80+
retry_policy = kwargs.pop("retry_policy")
81+
return AMQPClientAsync(
82+
"amqps://" + config.hostname,
83+
debug=config.logging_enable,
84+
error_policy=retry_policy,
85+
keep_alive_interval=config.keep_alive,
86+
encoding=config.encoding,
87+
**kwargs,
88+
)
89+
6790
@staticmethod
6891
def create_send_client_async(config: "Configuration", **kwargs: Any) -> "SendClientAsync": # pylint:disable=docstring-keyword-should-match-keyword-only
6992
"""

0 commit comments

Comments
 (0)