public async Task <HttpResponseMessage> TruncateFile(string path, string filename, int maxBytes) { try { await local.TruncateFile(path, filename, maxBytes); return(new HttpResponseMessage(System.Net.HttpStatusCode.OK)); } catch (Exception ex) { Console.WriteLine(ex.Message); return(new HttpResponseMessage(System.Net.HttpStatusCode.InternalServerError)); //{ ReasonPhrase = ex.Message }; } }
public async Task <MessageResponse> TruncateFileHandler(Message message, object context) { try { string sourcePath = message.Properties["path"]; string sourceFilename = message.Properties["filename"]; int maxBytes = Convert.ToInt32(message.Properties["maxBytes"]); await local.TruncateFile(sourcePath, sourceFilename, maxBytes); } catch (Exception ex) { Console.WriteLine("ERROR: EdgeHub-TruncateFileHandler '{0}'", ex.Message); } finally { ModuleClient mc = (ModuleClient)context; await mc.CompleteAsync(message); } return(MessageResponse.Completed); }