public int StopConsumer(string consumerID) { int stopped = 0; Guid guid = new Guid(consumerID); Debug.WriteLine(String.Format("Trying to stop consumer {0}", consumerID), this.GetType().Name); try { stopped = DataMarshal.StopConsumer(guid); } catch (Exception ex) { Debug.WriteLine("Failed to stop consumer with Id " + consumerID, this.GetType().Name); Debug.WriteLine(ex.ToString()); var detail = new ErrorDetail( ErrorDetail.Codes.DATAFORMAT_ERROR, "Failed consumer with Id " + consumerID + ", traceback: " + ex.StackTrace.ToString() ); throw new WebFaultException <ErrorDetail>(detail, System.Net.HttpStatusCode.NotFound); } switch (stopped) { case -1: Debug.WriteLine("Consumer is already down", this.GetType().Name); break; case 0: Debug.WriteLine(String.Format("Failed to stop consumer {0}", consumerID), this.GetType().Name); break; default: Debug.WriteLine(String.Format("Succeeded to stop consumer {0}", consumerID), this.GetType().Name); break; } return(stopped); }