You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -77,25 +76,25 @@ ServiceBusErrors often have an underlying AMQP error code which specifies whethe
77
76
*`retry_mode`: The delay behavior between retry attempts. Supported values are 'fixed' or 'exponential'
78
77
When an exception is surfaced to the application, either all retries were applied unsuccessfully, or the exception was considered non-transient.
79
78
80
-
#### Authentication Exceptions
79
+
#### Authentication exceptions
81
80
82
81
-**ServiceBusAuthenticationError:** An error occurred when authenticating the connection to the service. This may have been caused by the credentials being incorrect. It is recommended to check the credentials.
83
82
84
-
-**ServiceBusAuthorizationError:** An error occurred when authorizing the connection to the service. This may have been caused by the credentials not having the right permission to perform the operation. It is recommended to check the permission of the credentials.
83
+
-**ServiceBusAuthorizationError:** An error occurred when authorizing the connection to the service. This may have been caused by the credentials not having the right permission to perform the operation, or could be transient due to clock skew or service issues. The client will retry these errors automatically. If you continue to see this exception, it means all configured retries were exhausted - check the permission of the credentials and consider adjusting retry configuration.
85
84
86
85
See the [Troubleshooting Authentication issues](#troubleshooting-authentication-issues) section to troubleshoot authentication/permission issues.
87
86
88
-
#### Connection and Timeout Exceptions
87
+
#### Connection and timeout exceptions
89
88
90
-
-**ServiceBusConnectionError:** An error occurred in the connection to the service. This may have been caused by a transient network issue or service problem. It is recommended to retry.
89
+
-**ServiceBusConnectionError:** An error occurred in the connection to the service. This may have been caused by a transient network issue or service problem. The client automatically retries these errors - if you see this exception, all configured retries were exhausted. Consider adjusting retry configuration rather than implementing additional retry logic.
91
90
92
-
-**OperationTimeoutError:** This indicates that the service did not respond to an operation within the expected amount of time. This may have been caused by a transient network issue or service problem. The service may or may not have successfully completed the request; the status is not known. It is recommended to attempt to verify the current state and retry if necessary.
91
+
-**OperationTimeoutError:** This indicates that the service did not respond to an operation within the expected amount of time. This may have been caused by a transient network issue or service problem. The service may or may not have successfully completed the request; the status is not known. The client automatically retries these errors - if you see this exception, all configured retries were exhausted. Consider verifying the current state and adjusting retry configuration if necessary.
93
92
94
-
-**ServiceBusCommunicationError:** Client isn't able to establish a connection to Service Bus. Make sure the supplied host name is correct and the host is reachable. If your code runs in an environment with a firewall/proxy, ensure that the traffic to the Service Bus domain/IP address and ports isn't blocked. For details on which ports need to be open, see the [Azure Service Bus FAQ: What ports do I need to open on the firewall?](https://learn.microsoft.com/azure/service-bus-messaging/service-bus-faq#what-ports-do-i-need-to-open-on-the-firewall--).
93
+
-**ServiceBusCommunicationError:** Client isn't able to establish a connection to Service Bus. Make sure the supplied host name is correct and the host is reachable. If your code runs in an environment with a firewall/proxy, ensure that the traffic to the Service Bus domain/IP address and ports isn't blocked. For details on which ports need to be open, see the [Azure Service Bus FAQ: What ports do I need to open on the firewall?](https://learn.microsoft.com/azure/service-bus-messaging/service-bus-faq#what-ports-do-i-need-to-open-on-the-firewall--). You can also try setting the WebSockets transport type (`TransportType.AmqpOverWebsocket`) which often works around port/firewall issues.
95
94
96
95
See the [Troubleshooting Connectivity issues](#troubleshooting-connectivity-issues) section to troubleshoot connection and timeout issues. More information on AMQP errors in Azure Service Bus can be found [here](https://learn.microsoft.com/azure/service-bus-messaging/service-bus-amqp-troubleshoot).
97
96
98
-
#### Message and Session Handling Exceptions
97
+
#### Message and session handling exceptions
99
98
100
99
-**MessageSizeExceededError:** This indicates that the max message size has been exceeded. The message size includes the body of the message, as well as any associated metadata and system overhead. The best approach for resolving this error is to reduce the number of messages being sent in a batch or the size of the body included in the message. Because size limits are subject to change, please refer to [Service Bus quotas](https://learn.microsoft.com/azure/service-bus-messaging/service-bus-quotas) for specifics.
101
100
@@ -111,17 +110,17 @@ See the [Troubleshooting Connectivity issues](#troubleshooting-connectivity-issu
111
110
112
111
See the [Troubleshooting message handling issues](#troubleshooting-message-handling-issues) section to troubleshoot message and session lock issues.
113
112
114
-
#### Service and Entity Exceptions
113
+
#### Service and entity exceptions
115
114
116
115
-**ServiceBusQuotaExceededError:** This typically indicates that there are too many active receive operations for a single entity. In order to avoid this error, reduce the number of potential concurrent receives. You can use batch receives to attempt to receive multiple messages per receive request. Please see [Service Bus quotas](https://learn.microsoft.com/azure/service-bus-messaging/service-bus-quotas) for more information.
117
116
118
-
-**ServiceBusServerBusyError:** Service isn't able to process the request at this time. Client can wait for a period of time, then retry the operation.
117
+
-**ServiceBusServerBusyError:** Service isn't able to process the request at this time. Client can wait for a period of time, then retry the operation. For more information about quotas and limits, see [Service Bus quotas](https://learn.microsoft.com/azure/service-bus-messaging/service-bus-quotas).
119
118
120
119
-**MessagingEntityNotFoundError:** Entity associated with the operation doesn't exist or it has been deleted. Please make sure the entity exists.
121
120
122
121
-**MessagingEntityDisabledError:** Request for a runtime operation on a disabled entity. Please activate the entity.
123
122
124
-
#### Auto Lock Renewal Exceptions
123
+
#### Auto lock renewal exceptions
125
124
126
125
-**AutoLockRenewFailed:** An attempt to renew a lock on a message or session in the background has failed. This could happen when the receiver used by `AutoLockRenewer` is closed or the lock of the renewable has expired. It is recommended to re-register the renewable message or session by receiving the message or connect to the sessionful entity again.
127
126
@@ -133,7 +132,7 @@ See the [Troubleshooting message handling issues](#troubleshooting-message-handl
133
132
134
133
### Thread safety limitations
135
134
136
-
**Important:** We do not guarantee that the ServiceBusClient, ServiceBusSender, and ServiceBusReceiver are thread-safe or coroutine-safe. We do not recommend reusing these instances across threads or sharing them between coroutines.
135
+
**Important:** We do not guarantee that the `ServiceBusClient`, `ServiceBusSender`, and `ServiceBusReceiver` are thread-safe or coroutine-safe. We do not recommend reusing these instances across threads or sharing them between coroutines.
137
136
138
137
The data model type, `ServiceBusMessageBatch` is not thread-safe or coroutine-safe. It should not be shared across threads nor used concurrently with client methods.
139
138
@@ -174,7 +173,9 @@ async with client:
174
173
await asyncio.gather(*(send_batch(i, sender) for i inrange(5)))
175
174
```
176
175
177
-
For scenarios requiring concurrent sending from multiple threads, ensure proper thread-safety management using mechanisms like threading.Lock(). **Note:** Native async APIs should be used instead of running in a ThreadPoolExecutor, if possible.
176
+
For scenarios requiring concurrent sending from multiple threads, ensure proper thread-safety management using mechanisms like `threading.Lock()`.
177
+
178
+
> **NOTE:** Native async APIs should be used instead of running in a `ThreadPoolExecutor`, if possible.
178
179
179
180
```python
180
181
import threading
@@ -204,7 +205,7 @@ with client:
204
205
executor.submit(send_batch, i, sender)
205
206
```
206
207
207
-
## Troubleshooting Authentication issues
208
+
## Troubleshooting authentication and authorization issues
208
209
209
210
Authentication errors typically occur when the credentials provided are incorrect or have expired. Authorization errors occur when the authenticated identity doesn't have sufficient permissions.
210
211
@@ -216,7 +217,7 @@ The following verification steps are recommended, depending on the type of autho
216
217
217
218
-[Verify the correct RBAC roles were granted](https://learn.microsoft.com/azure/service-bus-messaging/service-bus-managed-service-identity) - Indicated by errors: `Send/Listen claim(s) are required to perform this operation.` In this case, ensure that the appropriate roles were assigned: `Azure Service Bus Data Owner`, `Azure Service Bus Data Sender`, or `Azure Service Bus Data Receiver`.
218
219
219
-
## Troubleshooting Connectivity issues
220
+
## Troubleshooting connectivity issues
220
221
221
222
### Timeout when connecting to service
222
223
@@ -236,19 +237,19 @@ To troubleshoot:
236
237
237
238
### SSL handshake failures
238
239
239
-
This error can occur when an intercepting proxy is used. To verify, it is recommended that the application be tested in the host environment with the proxy disabled.
240
+
This error can occur when an intercepting proxy is used. To verify, it is recommended that the application be tested in the host environment with the proxy disabled. Note that intercepting proxies are not a supported scenario.
240
241
241
242
### Adding components to the connection string does not work
242
243
243
244
The current generation of the Service Bus client library supports connection strings only in the form published by the Azure portal. These are intended to provide basic location and shared key information only; configuring behavior of the clients is done through its options.
244
245
245
246
Previous generations of the Service Bus clients allowed for some behavior to be configured by adding key/value components to a connection string. These components are no longer recognized and have no effect on client behavior.
246
247
247
-
#### "TransportType.AmqpOverWebSocket" Alternative
248
+
#### Specifying AMQP over websockets
248
249
249
250
To configure web socket use, pass the [`transport_type=TransportType.AmqpOverWebsocket`](https://learn.microsoft.com/python/api/azure-servicebus/azure.servicebus.transporttype?view=azure-python) to the ServiceBusClient.
250
251
251
-
#### Azure Identity Authentication Alternative
252
+
#### Using Service Bus with Azure Identity
252
253
253
254
To authenticate with Azure Identity, see: [Client Identity Authentication](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/servicebus/azure-servicebus/samples/sync_samples/client_identity_authentication.py).
254
255
@@ -262,9 +263,9 @@ Messages, sessionful and non-sessionful, in Service Bus have a lock duration dur
262
263
263
264
**MessageLockLostError and SessionLockLostError resolution:**
264
265
1. Process messages faster or increase lock duration
265
-
2. If setting `prefetch_count` to a large number, consider setting it lower as it can cause message lock expiration if processing takes too long. The client cannot extend locks for prefetched messages.
266
+
2. If setting `prefetch_count` to a large number, consider setting it lower as the lock timer starts running when the message is fetched, even though not visible to the application and the client cannot extend locks for prefetched messages.
266
267
3. Use `AutoLockRenewer` for long-running processing.
267
-
* When running the async AutoLockRenewer, ensure that the event loop is not blocked during message processing. (e.g. `time.sleep(60)` --> `await asyncio.sleep(60)`). Otherwise, the AutoLockRenewer will be prevented from running in the background.
268
+
* When running the async `AutoLockRenewer`, ensure that the event loop is not blocked during message processing. (e.g. `time.sleep(60)` --> `await asyncio.sleep(60)`). Otherwise, the `AutoLockRenewer` will be prevented from running in the background.
268
269
269
270
```python
270
271
from azure.servicebus import AutoLockRenewer
@@ -284,12 +285,7 @@ with receiver:
284
285
1. Reduce message payload size
285
286
2. Consider splitting large messages across multiple smaller messages
286
287
287
-
**Service Bus message size limits:**
288
-
- Standard tier: 256 KB per message
289
-
- Premium tier: 1 MB per message
290
-
291
-
For the most up-to-date information on Service Bus limits, refer to the [Azure Service Bus quotas and limits](https://learn.microsoft.com/azure/service-bus-messaging/service-bus-quotas) documentation.
292
-
288
+
For the most up-to-date information on Service Bus message size limits, refer to the [Azure Service Bus quotas and limits](https://learn.microsoft.com/azure/service-bus-messaging/service-bus-quotas) documentation.
293
289
294
290
## Troubleshooting receiver issues
295
291
@@ -299,7 +295,7 @@ When attempting to receive multiple messages using `receive_messages()` with `ma
299
295
300
296
**Why this happens:**
301
297
- Service Bus optimizes for throughput and latency
302
-
- After the first message is received, the receiver waits only a short time (typically 20ms) for additional messages
298
+
- After the first message is received, the receiver prioritizes processing it and does not attempt to build a batch of the requested size
303
299
- The `max_wait_time` controls how long to wait for the **first** message, not subsequent ones
Mixing synchronous and asynchronous Service Bus operations can cause issues such as async operations, such as the `AutoLockRenewer`, hanging indefinitely due to the event loop being blocked. Ensure that blocking calls are not made when receiving and message processing.
361
+
Mixing synchronous and asynchronous Service Bus operations can cause issues such as the `AutoLockRenewer` hanging indefinitely because the event loop is blocked. Ensure that blocking calls are not made when receiving and processing messages asynchronously.
366
362
367
363
### Dead letter queue issues
368
364
@@ -389,7 +385,6 @@ with dlq_receiver:
389
385
print(f"Dead letter description: {message.dead_letter_error_description}")
390
386
```
391
387
392
-
393
388
## Quotas
394
389
395
390
Information about Service Bus quotas can be found [here](https://learn.microsoft.com/azure/service-bus-messaging/service-bus-quotas).
@@ -402,8 +397,6 @@ Information about Service Bus quotas can be found [here](https://learn.microsoft
402
397
3. Check if the entity was deleted and needs to be recreated
403
398
4. Verify you're connecting to the correct namespace
404
399
405
-
## Troubleshooting async operations
406
-
407
400
## Get additional help
408
401
409
402
Additional information on ways to reach out for support can be found in the [SUPPORT.md](https://github.com/Azure/azure-sdk-for-python/blob/main/SUPPORT.md) at the root of the repo.
0 commit comments