-
Notifications
You must be signed in to change notification settings - Fork 21.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Document the required info for dynamic routing #25007
Comments
@bryanklewis Thanks for your feedback. As per the document, "you can also use dynamic routing, where your data includes the necessary routing information" signifies the information like table name, file format, and mapping which we need to provide while creating New Data Connection with static routing, is not needed in case of dynamic routing. Please refer below screenshots in case of static and dynamic routing which might give you clear picture, what this document is referring to. Static Routing: Dynamic Routing: @orspod Could you please review the document and update it appropriately, So that there is no confusion further. @bryanklewis Please let us know if you still have any concerns. |
Understand the options in the portal, but that immediately invokes the question around what is required or rather, what data is Azure Data Explorer looking for inside a given event to fulfill those data elements? I assume some key in a key=value pair named a special way will allow ADX to find the table name, file format, and mapping. What is that key? Do those keys need to be at the root level? Anything special for Avro vs json vs csv? Looks like a very powerful feature to be able to dynamically route my event hub, just not enough info in order to model my events. |
Or does the ingest service use the event hub name as the table name, reads the format, and uses X to determine the mapping? Not sure... |
@bryanklewis, thanks for your feedback. I am working on updating the documentation to answer your questions. In the meantime, @radennis, will you address the question above? |
@bryanklewis I found the following information from preview timeframe, but I haven't tested it first hand, so the experience could vary in the current version. See if this helps for now: Dynamic routing means that events read from a single Event Hub can land in different tables in your Kusto cluster. This requires the following properties to be added to the EventData.Properties bag:
|
#in-progress |
@bryanklewis I have assigned this issue to @JasonWHowell to help you further. |
@bryanklewis I don't have any extra detail yet. Did that bit I offered unblock you? We'll explain more in the docs in our next revision, but it might be a few weeks. |
@JasonWHowell Yes, the EventData.Properties bag was the enabler. Adding the keys "Table", "Format", "IngestionMappingReference" with the appropriate values routed the events correctly from Event Hubs to Azure Data Explorer. Example sending events from .net core in json format
// Creates an event hub client and sends messages to the event hub.
private static async Task SendMessagesToEventHub(int numMessagesToSend)
{
for (var i = 0; i < numMessagesToSend; i++)
{
try
{
// send every other table
int tableId = ((i % 2) == 0) ? 2 : 1;
string tableName = "log" + tableId.ToString();
// serialize as json
Dictionary<string, string> newMessage = new Dictionary<string, string>
{
{ "timestamp", DateTime.UtcNow.ToString() },
{ "message", $"Message {i} for {tableName}" }
};
string newMessageJson = JsonConvert.SerializeObject(newMessage, Formatting.None);
// set properties to route
var newEvent = new EventData(Encoding.UTF8.GetBytes(newMessageJson));
newEvent.Properties.Add("Table", tableName);
newEvent.Properties.Add("Format", "json");
newEvent.Properties.Add("IngestionMappingReference", "basicmsg");
Console.WriteLine($"Sending message: {newMessage["message"]}");
await eventHubClient.SendAsync(newEvent);
}
catch (Exception exception)
{
Console.WriteLine($"{DateTime.Now} > Exception: {exception.Message}");
}
await Task.Delay(10);
}
Console.WriteLine($"{numMessagesToSend} messages sent.");
} |
@bryanklewis 🥇 nice work. #please-close |
@bryanklewis We will now proceed to close this thread. If there are further questions regarding this matter, please tag me in your reply. We will gladly continue the discussion and we will reopen the issue. |
@BryanTrach-MSFT @JasonWHowell @orspod The comments under this GitHub issue are useful and answers to the original question. I was wondering if this information is also captured in the documentation and if yes, could you add the link here as comment so that it is easy to find. |
It might be interesting for someone that data = {}
tableName = 'TestTable'
tableMapping = 'TestMapping'
event = EventData(json.dumps(data).encode('UTF-8'))
event.application_properties = {
'Table': tableName,
'Format': "json",
'IngestionMappingReference': tableMapping,
}
sender.send(event) |
@JasonWHowell is there now a doc that describes the more complex scenario? |
@arsenvlad Let's check with @orspod since I'm no longer on this project. |
@arsenvlad , a sample with dynamic routing was added as a link in the note in the Event Hub ingestion doc. |
If my data is coming from IOT Hub where do I change the settings in IOT Hub so that below works ? Dynamic routing means that events read from a single Event Hub can land in different tables in your Kusto cluster. This requires the following properties to be added to the EventData.Properties bag: Table - name (case sensitive) of the target Data Explorer table |
@MikeWilcoxMicrosoft - thanks for your question. Best practice is to open a new request/issue but we are happy to assist you. @kerend - can you assist? |
The Event Hub ingest for Azure Data Explorer mentions that "you can also use dynamic routing, where your data includes the necessary routing information". What is the information required in an event to use dynamic routing? Example?
Document Details
⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.
The text was updated successfully, but these errors were encountered: