I want to send the data from my code to Azure Event hub and finally to Azure Data Explorer. I sent the json data to event hub using typescript with the help of following code snippet:
async function sendToEventHub(data: any) {
const producerClient = new EventHubProducerClient(connectionString, eventHubName);
let batch = await producerClient.createBatch();
batch.tryAdd({body: data});
await producerClient.sendBatch(batch);
await producerClient.close();
};
const data = {
"runId": "abc",
"startTime": "1234",
"endTime": "1234",
"elapsedTime": "1234"
};
sendToEventHub(data).catch((err) => {
console.log("Error occurred: ", err);
});
I can see the incoming messages in event hub monitors. Then I created Azure Data explorer cluster and database. I ingested the data into this database and created new table 'test'. But when I ran the query to see the contents of table, it is coming as empty. You can see the snapshot here, Also see this.
I can interpret that the data is coming to data explorer but not able to show as the table schema(column names and types) was created with the help of data itself.
What am I missing here? I could see the data till the last step in the preview of ingestion of the data here.
I have used your code but it worked for me. The only modification I did is providing the data in the correct JSON format
{ "name": "Afreen", "age": 26 }
Code:
Azure Data Explorer: