github Azure/azure-sdk-for-python azure-servicebus_7.15.0b2

pre-release48 minutes ago

7.15.0b2 (2026-08-21)

Features Added

  • Added ServiceBusReceivedMessage.from_bytes() classmethod to construct a ServiceBusReceivedMessage from raw AMQP payload bytes without requiring the deprecated uamqp library. (#43979)
  • Added ServiceBusClient.list_queue_sessions() and ServiceBusClient.list_subscription_sessions() (sync and async) to list session IDs for entities with active messages or stored session state, with optional filtering by session-state update timestamp. The methods return an ItemPaged[str] (AsyncItemPaged[str] on the async client) so callers can iterate every session transparently or page with by_page(). Implements the com.microsoft:get-message-sessions management operation. (#46575)
  • Added sql_filter_count and correlation_filter_count properties to TopicRuntimeProperties, exposing the total number of SQL filters and correlation filters across all of a topic's subscriptions.
  • Added API version 2024-05 and made it the default for the management client, which is required for the topic filter counts above.

Bugs Fixed

  • Fixed a bug where messages returned by receive_deferred_messages had a lock_token of None, which prevented settling (completing, abandoning, dead-lettering, deferring) or renewing the lock on a deferred message in PEEK_LOCK mode. The lock token is now read from the lock-token field of the management-link response for deferred messages. (#42454)
  • Read com.microsoft:max-message-batch-size vendor property from the AMQP sender link to correctly limit batch size on Premium large-message entities, where max-message-size can be up to 100 MB but the batch limit is 1 MB.
  • Fixed a bug where sending a batched or multi-message payload with uamqp_transport=True raised TypeError: 'BatchMessage' object is not subscriptable (and a masked AttributeError on the list path) when the first message carried a message_id, session_id, or partition_key. The batch envelope properties are now set through the transport-appropriate code path. (regression from #42598)
  • Fixed a bug where the async receiver factory methods on azure.servicebus.aio.ServiceBusClient (get_queue_receiver, get_subscription_receiver) and the async ServiceBusReceiver annotated the auto_lock_renewer keyword with the synchronous AutoLockRenewer, causing static type checkers to reject the documented azure.servicebus.aio.AutoLockRenewer usage. The annotation now references the async AutoLockRenewer, matching the docstrings and runtime behavior. (#47948)
  • Fixed a bug where closing a PEEK_LOCK receiver did not release messages that had been prefetched into the client buffer or were still in flight, so they remained locked at the broker until lock expiry — delaying their redelivery and inflating their delivery count. On close, a non-session PEEK_LOCK receiver now drains the link (stopping the broker and flushing in-flight transfers) and releases the buffered messages (released disposition), so the broker can redeliver them immediately without incrementing the delivery count. (#42917)
  • Fixed a bug where the async pure-Python AMQP transport failed to connect with [Errno 22] Invalid argument (amqp:socket-error) inside containerized/virtualized environments such as Docker Desktop on macOS. The transport no longer reads back and re-applies platform-negotiated TCP options (e.g. TCP_MAXSEG) that some platforms reject via setsockopt. (#45394)
  • Fixed a bug where passing a fully_qualified_namespace that included a port and/or trailing path (for example the https://<namespace>.servicebus.windows.net:443/ form that Azure returns when provisioning a namespace) raised ServiceBusAuthenticationError. The namespace is now normalized to its bare host, matching the .NET and JavaScript SDKs. (#44034)
  • Fixed a bug where iterating over a ServiceBusReceiver suppressed automatic HTTP instrumentation (e.g. from opentelemetry-instrumentation-httpx/requests) while user code processed a received message, causing the user's own outbound HTTP spans to be dropped. The receive tracing span is now closed before the message is yielded to the caller, so suppression no longer leaks into message processing. (#42755)
  • Fixed a bug in the pyAMQP transport where decoding an incoming performative whose trailing null fields were omitted by the sender (permitted by AMQP 1.0 section 1.4) raised IndexError/TypeError. The decoded field list is now padded to the performative's full field count so omitted trailing fields read back as their AMQP-defined default, including the compact list0 encoding where every field is omitted. A field encoded as an explicit null but whose declared default is non-null (for example a max_frame_size set to null so the connection would compare None < 512) now also reads back as that default.
  • Fixed a bug where PEEK_LOCK settlements on the pure-Python AMQP transport were sent pre-settled even though the receiver link negotiates rcv-settle-mode=second, so the service's terminal outcome (including com.microsoft:message-lock-lost rejections) was discarded and a settlement the service never applied was indistinguishable from success — surfacing only as the message being redelivered at lock expiry. Settlements now wait for the service to confirm the outcome and raise when it is rejected, matching the .NET, Java, JavaScript, and Go SDKs, which all await the disposition unconditionally. This is a behavior change: confirming costs one service round trip per settlement, so settle many messages concurrently rather than one at a time (for example await asyncio.gather(*(receiver.complete_message(m) for m in messages))). Unaffected where outcomes cannot be observed: RECEIVE_AND_DELETE mode and uamqp_transport=True.

Other Changes

  • Clarified in the application_properties documentation (the ServiceBusMessage constructor, the application_properties property, and the README) that when a message is received, its keys and any string values are returned as bytes, not str, along with the recommended bytes-key access and decoding pattern. (#45082)
  • When using the async AmqpOverWebsocket transport on Python 3.10 or later, aiohttp>=3.14.0 is now recommended. Earlier aiohttp versions have a WebSocket heartbeat bug (aio-libs/aiohttp#12030) that can cause the connection to be dropped during long message processing, surfacing as a SocketError ("Cannot write to closing transport"). Python 3.9 users must upgrade Python to install an aiohttp release containing this fix. (#44028)
  • Management operations (peek, deferred receive, message settlement over the management link, lock renewal, session state, session listing, schedule/cancel) now send com.microsoft:server-timeout: the caller's remaining time less one second, or 60 seconds when none was given. Previously no bound was sent, so a stalled service held the call until the AMQP link failed; it now raises a retryable OperationTimeoutError, so a persistently stalled service surfaces after roughly four minutes at default retry settings. Matches the .NET, Java and Go SDKs.

Don't miss a new azure-sdk-for-python release

NewReleases is sending notifications on new releases.