public async Task SendDataAsync(CoffeMachineData data) { //throw new NotImplementedException(); var dataAsJson = JsonConvert.SerializeObject(data); var eventData = new EventData(Encoding.UTF8.GetBytes(dataAsJson)); await _eventHubClient.SendAsync(eventData); }
private async void MakeEspresso() { CounterEspresso++; CoffeMachineData CoffeMachieData = CreateCoffeMachineData(nameof(CounterEspresso), CounterEspresso); await sendDataAsync(CoffeMachieData); }
private async void MakeCuppoccino() { CounterCuppoccino++; CoffeMachineData CoffeMachieData = CreateCoffeMachineData(nameof(CounterCuppoccino), CounterCuppoccino); await sendDataAsync(CoffeMachieData); }
private async Task sendDataAsync(CoffeMachineData coffemachinedata) { try { await _coffeeMachineDataSender.SendDataAsync(coffemachinedata); WriteLog($"Sent Data: {coffemachinedata}"); } catch (Exception ex) { WriteLog($"Exception: {ex.Message}"); } }