Skip to content

Commit d6be5e9

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 d6be5e9

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,7 +65,29 @@ async def close_connection_async(connection: "ConnectionAsync") -> None:
6465
"""
6566
await connection.destroy_async()
6667

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

0 commit comments

Comments
 (0)