public static void PublishEvent(SalesOrderVersions version, ILogger log) { log.LogInformation($"C# Timer trigger function executed at: {DateTime.Now}"); ISalesOrder order = SalesOrder.CreateOrder(version); EventData eventData = new EventData(SalesOrder.AsJsonUTF8(order)); eventData.Properties.Add("SchemaVersion", order.SchemaVersion); log.LogInformation($"Sending message attempt: {SalesOrder.AsJson(order)}"); eventHubClient.SendAsync(eventData); }
public static byte[] AsJsonUTF8(ISalesOrder order) { return(Encoding.UTF8.GetBytes(SalesOrder.AsJson(order))); }