public async Task <HttpResponseMessage> CompressFile(string path, string filename, string compressPath, string compressFilename) { try { await local.CompressFile(path, filename, compressPath, compressFilename); 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> CompressFileHandler(Message message, object context) { try { string sourcePath = message.Properties["path"]; string sourceFilename = message.Properties["filename"]; string compressPath = message.Properties["compressPath"]; string compressFilename = message.Properties["compressFilename"]; await local.CompressFile(sourcePath, sourceFilename, compressPath, compressFilename); } catch (Exception ex) { Console.WriteLine("ERROR: EdgeHub-CompressFileHandler '{0}'", ex.Message); } finally { ModuleClient mc = (ModuleClient)context; await mc.CompleteAsync(message); } return(MessageResponse.Completed); }