Skip to content

Commit f70ce9f

Browse files
authored
[EventHubs] update readme to include uamqp backcompat section (#28198)
* update readme for uamqp backcompat * update readme/changelog * fix types for apiview
1 parent 8fc3f93 commit f70ce9f

File tree

6 files changed

+59
-15
lines changed

6 files changed

+59
-15
lines changed

sdk/eventhub/azure-eventhub/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
## 5.11.0 (2023-01-10)
44

5+
Version 5.11.0 is our first stable release of the Azure Event Hubs client library based on a pure Python implemented AMQP stack.
6+
57
### Features Added
68

79
- A new boolean keyword argument `uamqp_transport` has been added to sync and async `EventHubProducerClient`/`EventHubConsumerClient` constructors which indicates whether to use the `uamqp` library or the default pure Python AMQP library as the underlying transport.
@@ -12,6 +14,8 @@
1214

1315
### Other Changes
1416

17+
- The `message` attribute on `EventData`/`EventDataBatch`, which previously exposed the `uamqp.Message`, has been deprecated.
18+
- `LegacyMessage`/`LegacyBatchMessage` objects returned by the `message` attribute on `EventData`/`EventDataBatch` have been introduced to help facilitate the transition.
1519
- Removed uAMQP from required dependencies.
1620
- Adding `uamqp >= 1.6.3` as an optional dependency for use with the `uamqp_transport` keyword.
1721
- Added support for Python 3.11.

sdk/eventhub/azure-eventhub/README.md

Lines changed: 35 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -412,12 +412,44 @@ Reference documentation is available [here](https://azuresdkdocs.blob.core.windo
412412
The EventHubs SDK integrates nicely with the [Schema Registry][schemaregistry_service] service and [Avro][avro].
413413
For more information, please refer to [Schema Registry SDK][schemaregistry_repo] and [Schema Registry Avro Encoder SDK][schemaregistry_avroencoder_repo].
414414

415+
### Pure Python AMQP Transport and Backward Compatibility Support
416+
417+
The Azure Event Hubs client library is now based on a pure Python AMQP implementation. `uAMQP` has been removed as required dependency.
418+
419+
To use `uAMQP` as the underlying transport:
420+
421+
1. Install `uamqp` with pip.
422+
423+
```
424+
$ pip install uamqp
425+
```
426+
427+
2. Pass `uamqp_transport=True` during client construction.
428+
429+
```python
430+
from azure.eventhub import EventHubProducerClient, EventHubConsumerClient
431+
432+
connection_str = '<< CONNECTION STRING FOR THE EVENT HUBS NAMESPACE >>'
433+
consumer_group = '<< CONSUMER GROUP >>'
434+
eventhub_name = '<< NAME OF THE EVENT HUB >>'
435+
436+
client = EventHubProducerClient.from_connection_string(
437+
connection_str, eventhub_name=eventhub_name, uamqp_transport=True
438+
)
439+
client = EventHubConsumerClient.from_connection_string(
440+
connection_str, consumer_group, eventhub_name=eventhub_name, uamqp_transport=True
441+
)
442+
```
443+
444+
Note: The `message` attribute on `EventData`/`EventDataBatch`, which previously exposed the `uamqp.Message`, has been deprecated.
445+
The "Legacy" objects returned by `EventData.message`/`EventDataBatch.message` have been introduced to help facilitate the transition.
446+
415447
### Building uAMQP wheel from source
416448

417-
`azure-eventhub` depends on the [uAMQP](https://pypi.org/project/uamqp/) for the AMQP protocol implementation.
418-
uAMQP wheels are provided for most major operating systems and will be installed automatically when installing `azure-eventhub`.
449+
If [uAMQP](https://pypi.org/project/uamqp/) is intended to be used as the underlying AMQP protocol implementation for `azure-eventhub`,
450+
uAMQP wheels can be found for most major operating systems.
419451

420-
If you're running on a platform for which uAMQP wheels are not provided, please follow
452+
If you intend to use `uAMQP` and you're running on a platform for which uAMQP wheels are not provided, please follow
421453
the [uAMQP Installation](https://github.com/Azure/azure-uamqp-python#installation) guidance to install from source.
422454

423455
### Provide Feedback

sdk/eventhub/azure-eventhub/azure/eventhub/_consumer_client.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,14 +66,15 @@ class EventHubConsumerClient(
6666
:keyword float auth_timeout: The time in seconds to wait for a token to be authorized by the service.
6767
The default value is 60 seconds. If set to 0, no timeout will be enforced from the client.
6868
:keyword str user_agent: If specified, this will be added in front of the user agent string.
69-
:keyword int retry_total: The total number of attempts to redo a failed operation when an error occurs.
69+
:keyword retry_total: The total number of attempts to redo a failed operation when an error occurs.
7070
Default value is 3. The context of `retry_total` in receiving is special: The `receive` method is implemented
7171
by a while-loop calling internal receive method in each iteration. In the `receive` case,
7272
`retry_total` specifies the numbers of retry after error raised by internal receive method in the while-loop.
7373
If retry attempts are exhausted, the `on_error` callback will be called (if provided) with the error information.
7474
The failed internal partition consumer will be closed (`on_partition_close` will be called if provided) and
7575
new internal partition consumer will be created (`on_partition_initialize` will be called if provided) to resume
7676
receiving.
77+
:paramtype retry_total: int
7778
:keyword float retry_backoff_factor: A backoff factor to apply between attempts after the second try
7879
(most errors are resolved immediately by a second try without a delay).
7980
In fixed mode, retry policy will always sleep for {backoff factor}.
@@ -100,7 +101,7 @@ class EventHubConsumerClient(
100101
or a single partition. In the latter case load-balancing does not apply.
101102
If a checkpoint store is not provided, the checkpoint will be maintained internally
102103
in memory, and the `EventHubConsumerClient` instance will receive events without load-balancing.
103-
:paramtype checkpoint_store: ~azure.eventhub.CheckpointStore
104+
:paramtype checkpoint_store: Optional[~azure.eventhub.CheckpointStore]
104105
:keyword float load_balancing_interval: When load-balancing kicks in. This is the interval, in seconds,
105106
between two load-balancing evaluations. Default is 10 seconds.
106107
:keyword float partition_ownership_expiration_interval: A partition ownership will expire after this number
@@ -232,14 +233,15 @@ def from_connection_string(cls, conn_str, consumer_group, **kwargs):
232233
:keyword float auth_timeout: The time in seconds to wait for a token to be authorized by the service.
233234
The default value is 60 seconds. If set to 0, no timeout will be enforced from the client.
234235
:keyword str user_agent: If specified, this will be added in front of the user agent string.
235-
:keyword int retry_total: The total number of attempts to redo a failed operation when an error occurs.
236+
:keyword retry_total: The total number of attempts to redo a failed operation when an error occurs.
236237
Default value is 3. The context of `retry_total` in receiving is special: The `receive` method is implemented
237238
by a while-loop calling internal receive method in each iteration. In the `receive` case,
238239
`retry_total` specifies the numbers of retry after error raised by internal receive method in the while-loop.
239240
If retry attempts are exhausted, the `on_error` callback will be called (if provided) with the error
240241
information. The failed internal partition consumer will be closed (`on_partition_close` will be called
241242
if provided) and new internal partition consumer will be created (`on_partition_initialize` will be called if
242243
provided) to resume receiving.
244+
:paramtype retry_total: int
243245
:keyword float retry_backoff_factor: A backoff factor to apply between attempts after the second try
244246
(most errors are resolved immediately by a second try without a delay).
245247
In fixed mode, retry policy will always sleep for {backoff factor}.
@@ -266,7 +268,7 @@ def from_connection_string(cls, conn_str, consumer_group, **kwargs):
266268
or a single partition. In the latter case load-balancing does not apply.
267269
If a checkpoint store is not provided, the checkpoint will be maintained internally
268270
in memory, and the `EventHubConsumerClient` instance will receive events without load-balancing.
269-
:paramtype checkpoint_store: ~azure.eventhub.CheckpointStore
271+
:paramtype checkpoint_store: Optional[~azure.eventhub.CheckpointStore]
270272
:keyword float load_balancing_interval: When load-balancing kicks in. This is the interval, in seconds,
271273
between two load-balancing evaluations. Default is 10 seconds.
272274
:keyword float partition_ownership_expiration_interval: A partition ownership will expire after this number

sdk/eventhub/azure-eventhub/azure/eventhub/_producer_client.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,9 @@ class EventHubProducerClient(
9090
:keyword float auth_timeout: The time in seconds to wait for a token to be authorized by the service.
9191
The default value is 60 seconds. If set to 0, no timeout will be enforced from the client.
9292
:keyword str user_agent: If specified, this will be added in front of the user agent string.
93-
:keyword int retry_total: The total number of attempts to redo a failed operation when an error occurs. Default
93+
:keyword retry_total: The total number of attempts to redo a failed operation when an error occurs. Default
9494
value is 3.
95+
:paramtype retry_total: int
9596
:keyword float retry_backoff_factor: A backoff factor to apply between attempts after the second try
9697
(most errors are resolved immediately by a second try without a delay).
9798
In fixed mode, retry policy will always sleep for {backoff factor}.
@@ -465,8 +466,9 @@ def from_connection_string(
465466
:keyword float auth_timeout: The time in seconds to wait for a token to be authorized by the service.
466467
The default value is 60 seconds. If set to 0, no timeout will be enforced from the client.
467468
:keyword str user_agent: If specified, this will be added in front of the user agent string.
468-
:keyword int retry_total: The total number of attempts to redo a failed operation when an error occurs.
469+
:keyword retry_total: The total number of attempts to redo a failed operation when an error occurs.
469470
Default value is 3.
471+
:paramtype retry_total: int
470472
:keyword float retry_backoff_factor: A backoff factor to apply between attempts after the second try
471473
(most errors are resolved immediately by a second try without a delay).
472474
In fixed mode, retry policy will always sleep for {backoff factor}.

sdk/eventhub/azure-eventhub/azure/eventhub/aio/_consumer_client_async.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,14 +71,15 @@ class EventHubConsumerClient(
7171
:keyword float auth_timeout: The time in seconds to wait for a token to be authorized by the service.
7272
The default value is 60 seconds. If set to 0, no timeout will be enforced from the client.
7373
:keyword str user_agent: If specified, this will be added in front of the user agent string.
74-
:keyword int retry_total: The total number of attempts to redo a failed operation when an error occurs.
74+
:keyword retry_total: The total number of attempts to redo a failed operation when an error occurs.
7575
Default value is 3. The context of `retry_total` in receiving is special: The `receive` method is implemented
7676
by a while-loop calling internal receive method in each iteration. In the `receive` case,
7777
`retry_total` specifies the numbers of retry after error raised by internal receive method in the while-loop.
7878
If retry attempts are exhausted, the `on_error` callback will be called (if provided) with the error information.
7979
The failed internal partition consumer will be closed (`on_partition_close` will be called if provided) and
8080
new internal partition consumer will be created (`on_partition_initialize` will be called if provided) to resume
8181
receiving.
82+
:paramtype retry_total: int
8283
:keyword float retry_backoff_factor: A backoff factor to apply between attempts after the second try
8384
(most errors are resolved immediately by a second try without a delay).
8485
In fixed mode, retry policy will always sleep for {backoff factor}.
@@ -105,7 +106,7 @@ class EventHubConsumerClient(
105106
or a single partition. In the latter case load-balancing does not apply.
106107
If a checkpoint store is not provided, the checkpoint will be maintained internally
107108
in memory, and the `EventHubConsumerClient` instance will receive events without load-balancing.
108-
:paramtype checkpoint_store: ~azure.eventhub.aio.CheckpointStore
109+
:paramtype checkpoint_store: Optional[~azure.eventhub.aio.CheckpointStore]
109110
:keyword float load_balancing_interval: When load-balancing kicks in. This is the interval, in seconds,
110111
between two load-balancing evaluations. Default is 10 seconds.
111112
:keyword float partition_ownership_expiration_interval: A partition ownership will expire after this number
@@ -254,14 +255,15 @@ def from_connection_string(
254255
:keyword float auth_timeout: The time in seconds to wait for a token to be authorized by the service.
255256
The default value is 60 seconds. If set to 0, no timeout will be enforced from the client.
256257
:keyword str user_agent: If specified, this will be added in front of the user agent string.
257-
:keyword int retry_total: The total number of attempts to redo a failed operation when an error occurs.
258+
:keyword retry_total: The total number of attempts to redo a failed operation when an error occurs.
258259
Default value is 3. The context of `retry_total` in receiving is special: The `receive` method is implemented
259260
by a while-loop calling internal receive method in each iteration. In the `receive` case,
260261
`retry_total` specifies the numbers of retry after error raised by internal receive method in the while-loop.
261262
If retry attempts are exhausted, the `on_error` callback will be called (if provided) with the error
262263
information. The failed internal partition consumer will be closed (`on_partition_close` will be called
263264
if provided) and new internal partition consumer will be created (`on_partition_initialize` will be called if
264265
provided) to resume receiving.
266+
:paramtype retry_total: int
265267
:keyword float retry_backoff_factor: A backoff factor to apply between attempts after the second try
266268
(most errors are resolved immediately by a second try without a delay).
267269
In fixed mode, retry policy will always sleep for {backoff factor}.
@@ -285,7 +287,7 @@ def from_connection_string(
285287
or a single partition. In the latter case load-balancing does not apply.
286288
If a checkpoint store is not provided, the checkpoint will be maintained internally
287289
in memory, and the `EventHubConsumerClient` instance will receive events without load-balancing.
288-
:paramtype checkpoint_store: ~azure.eventhub.aio.CheckpointStore
290+
:paramtype checkpoint_store: Optional[~azure.eventhub.aio.CheckpointStore]
289291
:keyword float load_balancing_interval: When load-balancing kicks in. This is the interval, in seconds,
290292
between two load-balancing evaluations. Default is 10 seconds.
291293
:keyword float partition_ownership_expiration_interval: A partition ownership will expire after this number

sdk/eventhub/azure-eventhub/azure/eventhub/aio/_producer_client_async.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,9 @@ class EventHubProducerClient(
7777
:keyword float auth_timeout: The time in seconds to wait for a token to be authorized by the service.
7878
The default value is 60 seconds. If set to 0, no timeout will be enforced from the client.
7979
:keyword str user_agent: If specified, this will be added in front of the user agent string.
80-
:keyword int retry_total: The total number of attempts to redo a failed operation when an error occurs. Default
80+
:keyword retry_total: The total number of attempts to redo a failed operation when an error occurs. Default
8181
value is 3.
82+
:paramtype retry_total: int
8283
:keyword float retry_backoff_factor: A backoff factor to apply between attempts after the second try
8384
(most errors are resolved immediately by a second try without a delay).
8485
In fixed mode, retry policy will always sleep for {backoff factor}.
@@ -452,8 +453,9 @@ def from_connection_string(
452453
:keyword float auth_timeout: The time in seconds to wait for a token to be authorized by the service.
453454
The default value is 60 seconds. If set to 0, no timeout will be enforced from the client.
454455
:keyword str user_agent: If specified, this will be added in front of the user agent string.
455-
:keyword int retry_total: The total number of attempts to redo a failed operation when an error occurs.
456+
:keyword retry_total: The total number of attempts to redo a failed operation when an error occurs.
456457
Default value is 3.
458+
:paramtype retry_total: int
457459
:keyword float retry_backoff_factor: A backoff factor to apply between attempts after the second try
458460
(most errors are resolved immediately by a second try without a delay).
459461
In fixed mode, retry policy will always sleep for {backoff factor}.

0 commit comments

Comments
 (0)