Skip to content

Commit e2b73c7

Browse files
authored
[EH+SB] Thread Safety Documentation (Azure#31772)
* update thread safety * client method instances -> clients * app responsiblity * remove eventdata * specify * list out instances * update sample * update readme * update samples * update samples
1 parent 60d75b4 commit e2b73c7

File tree

4 files changed

+18
-8
lines changed

4 files changed

+18
-8
lines changed

sdk/eventhub/azure-eventhub/README.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,6 @@ The Azure Event Hubs client library allows for publishing and consuming of Azure
2020
| [Product documentation](https://docs.microsoft.com/azure/event-hubs/)
2121
| [Samples](https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/eventhub/azure-eventhub/samples)
2222

23-
## _Disclaimer_
24-
25-
_Azure SDK Python packages support for Python 2.7 has ended 01 January 2022. For more information and questions, please refer to https://github.com/Azure/azure-sdk-for-python/issues/20691_
26-
2723
## Getting started
2824

2925
### Prerequisites
@@ -98,6 +94,12 @@ its partition; if there are multiple readers on the same partition, then they wi
9894
For more concepts and deeper discussion, see: [Event Hubs Features](https://docs.microsoft.com/azure/event-hubs/event-hubs-features).
9995
Also, the concepts for AMQP are well documented in [OASIS Advanced Messaging Queuing Protocol (AMQP) Version 1.0](https://docs.oasis-open.org/amqp/core/v1.0/os/amqp-core-overview-v1.0-os.html).
10096

97+
### Thread safety
98+
99+
We do not guarantee that the EventHubProducerClient or EventHubConsumerClient are thread-safe. We do not recommend reusing these instances across threads. It is up to the running application to use these classes in a thread-safe manner.
100+
101+
The data model type, `EventDataBatch` is not thread-safe. It should not be shared across threads nor used concurrently with client methods.
102+
101103
## Examples
102104

103105
The following sections provide several code snippets covering some of the most common Event Hubs tasks, including:

sdk/servicebus/azure-servicebus/README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,6 @@ Use the Service Bus client library for Python to communicate between application
2222
**NOTE**: If you are using version 0.50 or lower and want to migrate to the latest version
2323
of this package please look at our [migration guide to move from Service Bus V0.50 to Service Bus V7][migration_guide].
2424

25-
## _Disclaimer_
26-
27-
_Azure SDK Python packages support for Python 2.7 ended 01 January 2022. For more information and questions, please refer to https://github.com/Azure/azure-sdk-for-python/issues/20691_
28-
2925
## Getting started
3026

3127
### Install the package
@@ -97,6 +93,10 @@ To interact with these resources, one should be familiar with the following SDK
9793

9894
* [ServiceBusMessage][message_reference]: When sending, this is the type you will construct to contain your payload. When receiving, this is where you will access the payload.
9995

96+
### Thread safety
97+
98+
We do not guarantee that the ServiceBusClient, ServiceBusSender, and ServiceBusReceiver are thread-safe. We do not recommend reusing these instances across threads. It is up to the running application to use these classes in a thread-safe manner.
99+
100100
## Examples
101101

102102
The following sections provide several code snippets covering some of the most common Service Bus tasks, including:

sdk/servicebus/azure-servicebus/samples/async_samples/auto_lock_renew_async.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@
99
Example to show usage of AutoLockRenewer asynchronously:
1010
1. Automatically renew locks on messages received from non-sessionful entity
1111
2. Automatically renew locks on the session of sessionful entity
12+
13+
We do not guarantee that this SDK is thread-safe. We do not recommend reusing the ServiceBusClient,
14+
ServiceBusSender, ServiceBusReceiver across threads. It is up to the running
15+
application to use these classes in a thread-safe manner.
1216
"""
1317

1418
import os

sdk/servicebus/azure-servicebus/samples/sync_samples/auto_lock_renew.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@
99
Example to show usage of AutoLockRenewer:
1010
1. Automatically renew locks on messages received from non-sessionful entity
1111
2. Automatically renew locks on the session of sessionful entity
12+
13+
We do not guarantee that this SDK is thread-safe. We do not recommend reusing the ServiceBusClient,
14+
ServiceBusSender, ServiceBusReceiver across threads. It is up to the running
15+
application to use these classes in a thread-safe manner.
1216
"""
1317

1418
import os

0 commit comments

Comments
 (0)