Skip to content

Commit 0c5fbb6

Browse files
authored
[EventHubs] geodr preview (#35644)
* update changelog readme setup.py * pass georep prop to desired capabilities
1 parent c68e336 commit 0c5fbb6

File tree

10 files changed

+29
-10
lines changed

10 files changed

+29
-10
lines changed

sdk/eventhub/azure-eventhub/CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# Release History
22

3+
## 5.13.0b1 (2024-05-16)
4+
5+
### Features Added
6+
7+
- Added support for georeplication and disaster recovery-enabled Event Hubs.
8+
39
## 5.12.0 (2024-05-16)
410

511
### Features Added

sdk/eventhub/azure-eventhub/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ There, you can also find detailed instructions for using the Azure CLI, Azure Po
3838
Install the Azure Event Hubs client library for Python with pip:
3939

4040
```
41-
$ pip install azure-eventhub
41+
$ pip install azure-eventhub==5.13.0b1
4242
```
4343

4444
### Authenticate the client

sdk/eventhub/azure-eventhub/azure/eventhub/_constants.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
EPOCH_SYMBOL = b"com.microsoft:epoch"
3434
TIMEOUT_SYMBOL = b"com.microsoft:timeout"
3535
RECEIVER_RUNTIME_METRIC_SYMBOL = b"com.microsoft:enable-receiver-runtime-metric"
36+
GEOREPLICATION_SYMBOL = b"com.microsoft:georeplication"
3637

3738
MAX_MESSAGE_LENGTH_BYTES = 1024 * 1024
3839
MAX_USER_AGENT_LENGTH = 512

sdk/eventhub/azure-eventhub/azure/eventhub/_consumer.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
EPOCH_SYMBOL,
1818
TIMEOUT_SYMBOL,
1919
RECEIVER_RUNTIME_METRIC_SYMBOL,
20+
GEOREPLICATION_SYMBOL,
2021
)
2122

2223
if TYPE_CHECKING:
@@ -148,9 +149,9 @@ def _create_handler(self, auth: Union[uamqp_JWTTokenAuth, JWTTokenAuth]) -> None
148149
event_position_selector(self._offset, self._offset_inclusive),
149150
)
150151
desired_capabilities = (
151-
[RECEIVER_RUNTIME_METRIC_SYMBOL]
152+
[RECEIVER_RUNTIME_METRIC_SYMBOL, GEOREPLICATION_SYMBOL]
152153
if self._track_last_enqueued_event_properties
153-
else None
154+
else [GEOREPLICATION_SYMBOL]
154155
)
155156

156157
self._handler = self._amqp_transport.create_receive_client(

sdk/eventhub/azure-eventhub/azure/eventhub/_producer.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
is_tracing_enabled,
3030
TraceAttributes
3131
)
32-
from ._constants import TIMEOUT_SYMBOL
32+
from ._constants import TIMEOUT_SYMBOL, GEOREPLICATION_SYMBOL
3333
from .amqp import AmqpAnnotatedMessage
3434

3535
_LOGGER = logging.getLogger(__name__)
@@ -136,6 +136,8 @@ def __init__(
136136
def _create_handler(
137137
self, auth: Union[uamqp_JWTTokenAuth, JWTTokenAuth]
138138
) -> None:
139+
140+
desired_capabilities = [GEOREPLICATION_SYMBOL]
139141
self._handler = self._amqp_transport.create_send_client(
140142
config=self._client._config, # pylint:disable=protected-access
141143
target=self._target,
@@ -146,6 +148,7 @@ def _create_handler(
146148
keep_alive_interval=self._keep_alive,
147149
client_name=self._name,
148150
link_properties=self._link_properties, # type: ignore
151+
desired_capabilities=desired_capabilities,
149152
properties=create_properties(
150153
self._client._config.user_agent, # pylint: disable=protected-access
151154
amqp_transport=self._amqp_transport,

sdk/eventhub/azure-eventhub/azure/eventhub/_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@
33
# Licensed under the MIT License.
44
# ------------------------------------
55

6-
VERSION = "5.11.8"
6+
VERSION = "5.13.0b1"

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

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,12 @@
1414
from ._async_utils import get_dict_with_loop_if_needed
1515
from .._common import EventData
1616
from .._utils import create_properties, event_position_selector
17-
from .._constants import EPOCH_SYMBOL, TIMEOUT_SYMBOL, RECEIVER_RUNTIME_METRIC_SYMBOL
17+
from .._constants import (
18+
EPOCH_SYMBOL,
19+
TIMEOUT_SYMBOL,
20+
RECEIVER_RUNTIME_METRIC_SYMBOL,
21+
GEOREPLICATION_SYMBOL,
22+
)
1823

1924
if TYPE_CHECKING:
2025
try:
@@ -145,9 +150,9 @@ def _create_handler(
145150
event_position_selector(self._offset, self._offset_inclusive),
146151
)
147152
desired_capabilities = (
148-
[RECEIVER_RUNTIME_METRIC_SYMBOL]
153+
[RECEIVER_RUNTIME_METRIC_SYMBOL, GEOREPLICATION_SYMBOL]
149154
if self._track_last_enqueued_event_properties
150-
else None
155+
else [GEOREPLICATION_SYMBOL]
151156
)
152157

153158
self._handler = self._amqp_transport.create_receive_client(

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
from typing import Iterable, Union, Optional, Any, AnyStr, List, TYPE_CHECKING, cast
1010

1111
from .._common import EventData, EventDataBatch
12+
from .._constants import GEOREPLICATION_SYMBOL
1213
from .._producer import _set_partition_key
1314
from .._utils import (
1415
create_properties,
@@ -119,6 +120,7 @@ def __init__(self, client: EventHubProducerClient, target: str, **kwargs: Any) -
119120
def _create_handler(
120121
self, auth: Union["uamqp_JWTTokenAsync", JWTTokenAuthAsync]
121122
) -> None:
123+
desired_capabilities = [GEOREPLICATION_SYMBOL]
122124
self._handler = self._amqp_transport.create_send_client(
123125
config=self._client._config, # pylint:disable=protected-access
124126
target=self._target,
@@ -129,6 +131,7 @@ def _create_handler(
129131
keep_alive_interval=self._keep_alive,
130132
client_name=self._name,
131133
link_properties=self._link_properties,
134+
desired_capabilities=desired_capabilities,
132135
properties=create_properties(
133136
self._client._config.user_agent, # pylint: disable=protected-access
134137
amqp_transport=self._amqp_transport,

sdk/eventhub/azure-eventhub/samples/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ There, you can also find detailed instructions for using the Azure CLI, Azure Po
101101

102102
1. Install the Azure Event Hubs client library for Python with [pip](https://pypi.org/project/pip/):
103103
```bash
104-
pip install azure-eventhub
104+
pip install azure-eventhub==5.13.0b1
105105
```
106106

107107
To run samples that utilize the Azure Active Directory for authentication, please install the `azure-identity` library:

sdk/eventhub/azure-eventhub/setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656
url='https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/eventhub/azure-eventhub',
5757
keywords="azure, azure sdk",
5858
classifiers=[
59-
"Development Status :: 5 - Production/Stable",
59+
"Development Status :: 4 - Beta",
6060
'Programming Language :: Python',
6161
'Programming Language :: Python :: 3 :: Only',
6262
'Programming Language :: Python :: 3',

0 commit comments

Comments
 (0)