Skip to content

Commit 40f61d5

Browse files
authored
[EventHubs] Warning partition key type (Azure#16909)
* add warning in the docs on partition key accepted type * address feedback
1 parent 1bfb95a commit 40f61d5

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

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

+4
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,8 @@ def send_batch(self, event_data_batch, **kwargs):
222222
A `TypeError` will be raised if partition_key is specified and event_data_batch is an `EventDataBatch` because
223223
`EventDataBatch` itself has partition_key.
224224
If both partition_id and partition_key are provided, the partition_id will take precedence.
225+
**WARNING: Please DO NOT pass a partition_key of non-string type. The Event Hub service ignores partition_key
226+
of non-string type, in which case events will be assigned to all partitions using round-robin.**
225227
:rtype: None
226228
:raises: :class:`AuthenticationError<azure.eventhub.exceptions.AuthenticationError>`
227229
:class:`ConnectError<azure.eventhub.exceptions.ConnectError>`
@@ -281,6 +283,8 @@ def create_batch(self, **kwargs):
281283
:keyword str partition_key: With the given partition_key, event data will be sent to
282284
a particular partition of the Event Hub decided by the service.
283285
If both partition_id and partition_key are provided, the partition_id will take precedence.
286+
**WARNING: Please DO NOT pass a partition_key of non-string type. The Event Hub service ignores partition_key
287+
of non-string type, in which case events will be assigned to all partitions using round-robin.**
284288
:keyword int max_size_in_bytes: The maximum size of bytes data that an EventDataBatch object can hold. By
285289
default, the value is determined by your Event Hubs tier.
286290
:rtype: ~azure.eventhub.EventDataBatch

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

+4
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,8 @@ async def send_batch(
253253
A `TypeError` will be raised if partition_key is specified and event_data_batch is an `EventDataBatch` because
254254
`EventDataBatch` itself has partition_key.
255255
If both partition_id and partition_key are provided, the partition_id will take precedence.
256+
**WARNING: Please DO NOT pass a partition_key of non-string type. The Event Hub service ignores partition_key
257+
of non-string type, in which case events will be assigned to all partitions using round-robin.**
256258
:rtype: None
257259
:raises: :class:`AuthenticationError<azure.eventhub.exceptions.AuthenticationError>`
258260
:class:`ConnectError<azure.eventhub.exceptions.ConnectError>`
@@ -316,6 +318,8 @@ async def create_batch(
316318
:param str partition_key: With the given partition_key, event data will be sent to
317319
a particular partition of the Event Hub decided by the service.
318320
If both partition_id and partition_key are provided, the partition_id will take precedence.
321+
**WARNING: Please DO NOT pass a partition_key of non-string type. The Event Hub service ignores partition_key
322+
of non-string type, in which case events will be assigned to all partitions using round-robin.**
319323
:param int max_size_in_bytes: The maximum size of bytes data that an EventDataBatch object can hold. By
320324
default, the value is determined by your Event Hubs tier.
321325
:rtype: ~azure.eventhub.EventDataBatch

0 commit comments

Comments
 (0)