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']

--

--

--

I’m a keen traveler to see every country in the world, passionate about cutting edge technologies.

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Rails 5 API, React, Bitbucket Pipelines and AWS Elastic Beanstalk — Part One

More Team One-on-Ones

Coding for Beginners

🕹 UPDATE: BALANCE GAME 🔥

Advanced React Native #1: Absolute Power — Native Modules

Image scanning : tricks and toolkits

CS371p Spring 2022: Week 11

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
Victor Leung

Victor Leung

I’m a keen traveler to see every country in the world, passionate about cutting edge technologies.

More from Medium

Apache Kafka Connect to Azure Event Hubs

View and query collected data

Azure Data Factory — Run single instance of pipeline at a time

Run A Small/Medium Sized Wikipedia Clone on Microsoft Azure