Azure EventHub, LogicApp and DataVerse

import time
import os
from azure.eventhub import EventHubProducerClient, EventData
from azure.eventhub.exceptions import EventHubError
import json
EVENTHUB_NAME = "REPLACE_WITH_EVENTHUB_NAME"
CONNECTION_STR = "Endpoint=sb://REPLEASE_WITH_CONNECTION_STRING.servicebus.windows.net/;SharedAccessKeyName=RootManageSharedAccessKey;SharedAccessKey=REPLACE_WITH_SHARED_ACCESS_KEY"
body = json.dumps({
"id": "something"
})
def send_event_data_batch(producer, i):
# Without specifying partition_id or partition_key
# the events will be distributed to available partitions via round-robin.
event_data_batch = producer.create_batch()
event_data_batch.add(EventData(body))
producer.send_batch(event_data_batch)
producer = EventHubProducerClient.from_connection_string(
conn_str=CONNECTION_STR,
eventhub_name=EVENTHUB_NAME
)
start_time = time.time()
with producer:
for i in range(3):
send_event_data_batch(producer, i)
print("Send messages in {} seconds.".format(time.time() - start_time))
{ "id": "something" }
json(decodeBase64(triggerBody()['ContentData']))['id']

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store