public async override Task<CommandProcessingResult> HandleCommandAsync(DeserializableCommand deserializableCommand) { if (deserializableCommand.CommandName == START_TELEMETRY) { var command = deserializableCommand.Command; try { var device = Device as EngineDevice; device.StartTelemetryData(); return CommandProcessingResult.Success; } catch (Exception) { return CommandProcessingResult.RetryLater; } } else if (NextCommandProcessor != null) { return await NextCommandProcessor.HandleCommandAsync(deserializableCommand); } return CommandProcessingResult.CannotComplete; }
public async Task SignalRejectedCommand(DeserializableCommand command) { if (command == null) { throw new ArgumentNullException("command"); } await Task.Run(() => { }); }
public async Task SignalRejectedCommand(DeserializableCommand command) { if (command == null) { throw new ArgumentNullException("command"); } Debug.Assert( !string.IsNullOrEmpty(command.LockToken), "command.LockToken is a null reference or empty string."); await AzureRetryHelper.OperationWithBasicRetryAsync( async () => { try { await _deviceClient.RejectAsync(command.LockToken); } catch (Exception ex) { _logger.LogError( "{0}{0}*** Exception: Reject Command ***{0}{0}Command Name: {1}{0}Command: {2}{0}Exception: {3}{0}{0}", Console.Out.NewLine, command.CommandName, command.Command, ex); } }); }