コード例 #1
0
        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);
        }
コード例 #2
0
 public static byte[] AsJsonUTF8(ISalesOrder order)
 {
     return(Encoding.UTF8.GetBytes(SalesOrder.AsJson(order)));
 }