Skip to content

Commit

Permalink
Small fix for missing annotation initialization (#7575)
Browse files Browse the repository at this point in the history
  • Loading branch information
yunhaoling authored Oct 3, 2019
1 parent f26de12 commit 5e69da5
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 0 deletions.
1 change: 1 addition & 0 deletions sdk/eventhub/azure-eventhubs/azure/eventhub/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
9 changes: 9 additions & 0 deletions sdk/eventhub/azure-eventhubs/tests/test_send.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 5e69da5

Please sign in to comment.