private static EventData CreateEventData(CoffeeMachineData coffeeMachineData)
        {
            var dataAsJson = JsonConvert.SerializeObject(coffeeMachineData);
            var eventData  = new EventData(Encoding.UTF8.GetBytes(dataAsJson));

            return(eventData);
        }
 public async Task SendDataAsync(CoffeeMachineData coffeeMachineData)
 {
     EventData eventData = CreateEventData(coffeeMachineData);
     await _eventHubClient.SendAsync(eventData);
 }
示例#3
0
 public async Task SendAsync(CoffeeMachineData data)
 {
     var dataAsJson = JsonConvert.SerializeObject(data);
     var eventData  = new EventData(Encoding.UTF8.GetBytes(dataAsJson));
     await _eventHubClient.SendAsync(eventData);
 }