diff --git a/sdk/eventhub/azure-eventhubs/azure/eventhub/common.py b/sdk/eventhub/azure-eventhubs/azure/eventhub/common.py index f29a4c35bbc2..30cd6111da76 100644 --- a/sdk/eventhub/azure-eventhubs/azure/eventhub/common.py +++ b/sdk/eventhub/azure-eventhubs/azure/eventhub/common.py @@ -80,6 +80,7 @@ def __init__(self, body=None): raise ValueError("EventData cannot be None.") else: self.message = Message(body) + self.message.annotations = {} def __str__(self): dic = { diff --git a/sdk/eventhub/azure-eventhubs/tests/asynctests/test_send_async.py b/sdk/eventhub/azure-eventhubs/tests/asynctests/test_send_async.py index aa301bad3119..306e547ac439 100644 --- a/sdk/eventhub/azure-eventhubs/tests/asynctests/test_send_async.py +++ b/sdk/eventhub/azure-eventhubs/tests/asynctests/test_send_async.py @@ -255,6 +255,15 @@ async def test_send_with_create_event_batch_async(connstr_receivers): client = EventHubClient.from_connection_string(connection_str, transport_type=TransportType.AmqpOverWebsocket, network_tracing=False) sender = client.create_producer() + event_data_batch = await sender.create_batch(max_size=100000, partition_key="0") + while True: + try: + event_data_batch.try_add(EventData('A single event data')) + except ValueError: + break + + await sender.send(event_data_batch) + event_data_batch = await sender.create_batch(max_size=100000) while True: try: diff --git a/sdk/eventhub/azure-eventhubs/tests/test_send.py b/sdk/eventhub/azure-eventhubs/tests/test_send.py index 1c34c672d99f..6b185d57fdad 100644 --- a/sdk/eventhub/azure-eventhubs/tests/test_send.py +++ b/sdk/eventhub/azure-eventhubs/tests/test_send.py @@ -257,6 +257,15 @@ def test_send_with_create_event_batch_sync(connstr_receivers): client = EventHubClient.from_connection_string(connection_str, transport_type=TransportType.AmqpOverWebsocket, network_tracing=False) sender = client.create_producer() + event_data_batch = sender.create_batch(max_size=100000, partition_key="0") + while True: + try: + event_data_batch.try_add(EventData('A single event data')) + except ValueError: + break + + sender.send(event_data_batch) + event_data_batch = sender.create_batch(max_size=100000) while True: try: